I'm running XAMPP 1.7.2 on Ubuntu 8.10 (Linux dt19.im.local 2.6.27-14-generic #1 SMP Tue Aug 18 16:25:45 UTC 2009 i686 GNU/Linux) and am using the PHP 5.3.0 Apache module as standard. For one virtual host I'd like to use PHP 5.2.X as it is part of a project which has a lot of legacy code which is not compatible with PHP 5.3.0. The virtual host configuration block and the applicable directory directive are as follows -
- Code: Select all
<VirtualHost 127.0.0.1:80 192.168.1.28:80>
ServerAdmin [SNIP]
DocumentRoot htdocs/[SNIP]/[SNIP]
ServerName [SNIP].localhost
ServerAlias www.[SNIP].localhost
ErrorLog logs/[SNIP]-error_log
CustomLog logs/[SNIP]-access_log common
# Must use PHP <5.3.0 (5.2.6 in production use)
# PHP 5.3.0 MySQL library drops support for <MySQL 4.1 password hashes which are used by the [SNIP] database
Action application/x-httpd-php "cgi-bin/php-5.2.6 -c /opt/lampp/etc/php.ini-pre1.7.2"
AddHandler application/x-httpd-php .php
</VirtualHost>
# Permissions required here even though cgi-bin has the +FollowSymLinks option set
# FollowSymLinks doesn't change the pathname matched against <Directory> sections
# See http://httpd.apache.org/docs/2.0/mod/core.html#options
<Directory /opt/lampp/bin>
AllowOverride None
Options +ExecCGI
<Files php-5.2.6>
Order allow,deny
Allow from all
</Files>
</Directory>
Checking phpinfo() output on the above virtual host (or using the default virtual host directive and accessing it via http://localhost/[SNIP]/[SNIP]/phpinfo.php rather than http://[SNIP].localhost/phpinfo.php) shows PHP 5.3.0 is running. After applying minor tweaks such as adding ScriptAlias or SetEnv options the problem persists. I've Googled for a good while and have checked the permissions and the like and tried the advice of other users (XAMPP or otherwise) either resulting in PHP 5.3.0 being used or a HTTP 400 bad request/invalid URI error. I've stuck with the configuration above as this is correct according to the PHP manual.
FYI cgi-bin/php-5.2.6 is a soft symbolic link to /opt/lampp/bin/php-5.2.6 (I've added the FollowSymLinks option to the cgi-bin directory directive in httpd.conf). I've tried installing php5-cgi from the Ubuntu repos and setting it up in a similar way, to no avail. I've also tried copying the executables into the cgi-bin directory, pointing the Action line directly to bin/php-5.2.6 and dropping the -c /opt/lampp/etc/php.ini-pre1.7.2 option in the Action line. I've even tried commenting out the LoadModule lines for PHP which results in a HTTP 400 bad request/invalid URI error. This demonstrates the fact that the PHP CGI use is being ignored.
Any help or pointers would be appreciated. I've checked httpd.conf and the extra/httpd-*.conf files and ensured all required includes are being loaded. I know that it's probably something stupid on my part which is causing this!
Thanks in advance for the assistance