Install Config Wiki

All about installing, configuring and troubleshooting

User Tools

Site Tools


Windows - How to Run Multiple Versions of PHP in IIS


Author: Kumar Kush June 5, 2012 at 3:45

Kumar Kush - Banking Associate at State Bank of India Jammu, India

Published in the comments at

All right. Here's the solution. Different PHP versions can be enabled and running side-by-side in IIS7. Here's the procedure that I have successfully tested on my machine. I am only briefing the process, considering that you are familiar with the IIS and FastCGI. If not, see the link:'

Download any different versions of non-thread safe zip packages with binaries of PHP from Extract them to separate folders in your hard-drive like C:\PHP5.2.14, C:\PHP5.4.3, etc. Open the php.ini files in all the folders and add/uncomment and change following settings in all of them.

session.save_path = “C:\Windows\Temp” expose_php = Off ;; Choose any path here, but mostly preferred is this open_basedir = “C:\inetpub\wwwroot” extension_dir = “ext” fastcgi.impersonate = 1 cgi.fix_pathinfo=1 cgi.force_redirect = 0 ;; You can chose different time zones for different web-sites date.timezone = “you time zone” ;; Enable any extensions that you want to per website, e.g. extension=php_mysql.dll extension=php_mysqli.dll

Open IIS Manager. Add as many Handler Mappings as the number of PHP versions you want to install. Simply change the path of Executable in the Edit Module Mapping dialog box. Name the Mappings as convenient to identify them easily, like PHP 5.2.14 via FastCGI and PHP 5.4.3 via FastCGI.

In the IIS section in IIS Manager, open FastCGI Settings. Here, check whether there are as many entries as the number of PHP versions you want to run. If not, click Add Applications from the right-pane. Select a php-cgi.exe from the folder of the required PHP version in the Full Path field in the 'Add FastCGI Application' dialog box. Click OK.

Now, copy your website folder to C:\inetpub\wwwroot or whatever path you choose in open_basedir setting in php.ini. In the IIS Manager, expand Sites→Default Web Site from the left pane. Select the website that you want to target to a specific version of PHP.

Open Handler Mapping, with a website selected from the left pane. You will find many mappings here. Look only for those entries that have been created by you (those which have path as *.php). Among them, retain the only one that you need for the particular web-site selected and Remove the others. This WILL NOT delete the mappings from you machine, but only from the web-site selected. You website will now run only on the PHP version whose Mapping you have retained. Do the same for any websites that you want to target to a specific PHP version. You can test it by running phpinfo() in the websites.

After you add new websites to wwwroot, they won't have any handler attached. Add a new handler targetting the desired PHP version. You are done.

This may not be the best procedure. But it worked for me. For verification, see this link:'

Hope it helps, in case someone needs this.

run_multiple_versions_php_iis.txt · Last modified: 2022/07/30 12:35 by wikiadmin