Invalid PHP version in server signature


#1

I have chosen to use PHP5 from the web panel, but the server signature still shows PHP4:
Apache/2.0.54 (Unix) PHP/4.4.4 mod_ssl/2.0.54 OpenSSL/0.9.7e mod_fastcgi/2.4.2 DAV/2 SVN/1.4.2 Server at * Port 80

But when i do phpinfo(), it shows the correct version (5.2.1), meaning the server signature is showing false information.

Any way to fix this?

Thanks,
Erko


#2

At DreamHost, PHP is set by default to run as CGI, when you choose PHP4/PHP5 in the panel, you are selecting which PHP CGI executable to use.

The PHP version shown in the server signature is for the Apache PHP module. You can configure Apache to run PHP as a module instead of CGI, but there are a few reasons why this is not recommended. See the wiki article linked below for further details.

http://www.wiki.dreamhost.com/KB_/Web_Programming/_CGI,_PHP,and_Databases/_PHP#What.27s_the_difference_between_PHP-CGI_and_PHP_as_an_Apache_module.3F

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#3

Running PHP as an Apache module didn’t fix this.
Any more ideas?

Thanks,
Erko


#4

I think you misunderstood my post, there really isn’t anything to ‘fix’.

The server signature is showing the version of PHP that is installed as an Apache module. If you configure Apache to run PHP as a module, PHP version 4.4.4 will be used regardless of the PHP version that you have set in the panel. I know of no way to change the version of PHP that Apache will use when configured to run PHP as a module.

However, the default behaviour here at DreamHost is to run PHP as CGI. In this case you can choose between PHP4 or PHP5 in the panel, but doing so will not alter the server signature, as the version displayed in the signature shows the PHP module installed, not the PHP CGI in use.

It is very late here, so I hope the above makes sense :wink:

Mark


Save [color=#CC0000]$50[/color] on DreamHost plans using [color=#CC0000]PRICESLASH[/color] promo code (Click for DreamHost promo code details)


#5

Thanks for the explanation!


#6

Question,

I am experiencing a similar problem where one part of my website sees PHP4 and the other sees PHP5, problem is, all my content sees only PHP4, but my site needs PHP5 to run (actually, this wouldn’t be a problem if they had DOMXML installed on the PHP4 version, since my code can use either DOM or DOMXML).

I have a php file that acts as a “server” page for all my other .php files. The file has no extension, so I use a .htaccess directive to tell Apache its a php file not a directory:

[color=#CC0000]

SetHandler application/x-httpd-php

[/color]

Basically, I use it as http://domain.com/main/file_to_load, and main displays my stie template and loads the corresponding .php file via an include statement (I make sure no one can link a maliscious file here, just so you know).

For some reason, any php served under this file sees PHP4.

I have created two examples of the phpinfo() output. info1.html is generated by calling phpinfo within my main file. info2.html is generated by calling phpinfo straight from a regular .php file.

Does this have something to do with my .htaccess file. Is my telling apache its a .php file causing it to use PHP as a module instead of as CGI? Is there a way to fix this? Any help would be appreciated.


#7

I am not an expert in these matters, but I think that is exactly what is happening.

Try changing your SetHandler line to;

SetHandler php5-cgi

Hopefully, this will rectify your issue.

Mark


Web Hosting Reviews | DreamHost Promo Code


#8

Thanks a bunch Mark. Replacing application/x-httpd-php with php5-cgi worked.

Boy, I’m sure the way DreamHost has things setup allows more flexibility, but I am spending a lot of time trying to get code to work that already works on two other systems. On to the next problem.