Sometimes you'll find that (for whatever crappy reason, supporting legacy junk apps being the most probable) you need to run multiple version of PHP on your web server. There are a bunch of different solutions I've found people suggesting (using virtual hosts, running one as a module and one as CGI, etc...) but if you're happy running PHP as CGI then this solution may be simpler for you.
The idea is that we'll set up a "default" version of PHP which will handle all our PHP pages, but then for any particular applications that need other versions we'll handle those differently.
So, first the default setup, open httpd.conf...
Then we'll override this setup for each of our applications that require a specific version of PHP.
Easy! No need to run multiple versions of Apache, or fight with strange configuration.
One thing you'll need to do is copy all of the DLL's from each PHP version into the root directory of that version, and of course have different php.ini's for each one, but I'm not going to go into all that config.
I've only tried this on Windows, but it should work on other platforms to.
The idea is that we'll set up a "default" version of PHP which will handle all our PHP pages, but then for any particular applications that need other versions we'll handle those differently.
So, first the default setup, open httpd.conf...
ScriptAlias /php-5/ "C:/php/5.3/"
AddType application/x-httpd-php .php
Action application/x-httpd-php "/php-5/php.exe"Then we'll override this setup for each of our applications that require a specific version of PHP.
ScriptAlias /php-4.4.9/ "C:/php/4.4.9"
<Location /my/old/app>
Action application/x-httpd-php "/php-4.4.9/php.exe"
</Location>
Easy! No need to run multiple versions of Apache, or fight with strange configuration.
One thing you'll need to do is copy all of the DLL's from each PHP version into the root directory of that version, and of course have different php.ini's for each one, but I'm not going to go into all that config.
I've only tried this on Windows, but it should work on other platforms to.

Leave a comment