Running Multiple Versions of PHP 5 Under Apache Side-by-Side

This guide will show you how to set up and run PHP 5.5 and 5.3 at the same time under Apache (but can also be used to set up and run any two, or more, different PHP 5 versions side-by-side).

1. Make sure WampDeveloper is currently using PHP 5.5 FCGI (check Components Tab). This will load the default/global PHP-FCGI configuration, which we will later override under a website or directory.

You’ll also need the PHP 5.3 FCGI version already downloaded and present on the system.

We’ll use PHP version 5.3.28 in this example.

2. Create a separate PHP configuration file for the specific PHP 5.3 version, php-5.3.28.0-r1-win32-vc9-standard-fcgi…

Make a copy of file:
C:\WampDeveloper\Config\Php\php-53.ini

Rename the copy:
C:\WampDeveloper\Config\Php\php-5.3.28.0-r1-win32-vc9-standard-fcgi.ini

Edit the new file and replace all occurrences of the global PHP path with the specific version’s path:

Replace:

C:\WampDeveloper\Components\Php\

With:

C:\WampDeveloper\Versions\Php\php-5.3.28.0-r1-win32-vc9-standard-fcgi\

Replace:

C:/WampDeveloper/Components/Php/

With:

C:/WampDeveloper/Versions/Php/php-5.3.28.0-r1-win32-vc9-standard-fcgi/

3. Edit the website’s HTTP and SSL VirtualHost files and insert into the “webroot” Directory block the overriding PHP-FCGI configuration:

<IfModule fcgid_module>
	FcgidWrapper "C:/WampDeveloper/Versions/Php/php-5.3.28.0-r1-win32-vc9-standard-fcgi/php-cgi.exe -c C:/WampDeveloper/Config/Php/php-5.3.28.0-r1-win32-vc9-standard-fcgi.ini" .php virtual
	FcgidWrapper "C:/WampDeveloper/Versions/Php/php-5.3.28.0-r1-win32-vc9-standard-fcgi/php-cgi.exe -c C:/WampDeveloper/Config/Php/php-5.3.28.0-r1-win32-vc9-standard-fcgi.ini" .php4 virtual
	FcgidWrapper "C:/WampDeveloper/Versions/Php/php-5.3.28.0-r1-win32-vc9-standard-fcgi/php-cgi.exe -c C:/WampDeveloper/Config/Php/php-5.3.28.0-r1-win32-vc9-standard-fcgi.ini" .php5 virtual
</IfModule>

This will set up the entire website to use the different PHP version. If instead you just want a specific directory using a different PHP version… Instead of using the “webroot” Directory block, create your own block next to it, and place the above configuration inside.

4. Save edited files. Restart Apache.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>