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

Posted: 2014-05-03 17:59:00

This guide will show you how to set up and run PHP 5.6 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.6 FCGI (check Components Tab). This will load the default/global PHP-FCGI configuration, which we will later override under a specific 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.29 in this example.

2. Create a separate PHP configuration file for the specific PHP 5.3 version, php-…

Make a copy of file:

Rename the copy:

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









3. Edit the website’s HTTP and SSL VirtualHost files and insert into the <Directory ".../webroot"> block the overriding PHP-FCGI configuration:

<IfModule fcgid_module>
	FcgidWrapper "C:/WampDeveloper/Versions/Php/php- -c C:/WampDeveloper/Config/Php/php-" .php virtual
	FcgidWrapper "C:/WampDeveloper/Versions/Php/php- -c C:/WampDeveloper/Config/Php/php-" .php4 virtual
	FcgidWrapper "C:/WampDeveloper/Versions/Php/php- -c C:/WampDeveloper/Config/Php/php-" .php5 virtual

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 Directory block next to it, and place the above configuration inside.

4. Save edited files. Restart Apache.