Running PHP 4 & 5 on the Same Machine (IIS)
by Admin | July 2nd, 2007
If you have ever tried searching on this topic you’ll quickly find a lot of complicated sets of instructions on how to get this setup. The problem with setting up two versions of php is how php finds the location of the php.ini. As of php 5.2.0, you can add a couple registry keys that will give two locations for the php.ini file, one for each version of php. Here are the step-by-step instructions:
Run php 4 and php 5.2.x on the same machine with IIS 6.0 as ISAPI.
1. Extract the ZIP packages of both php 4 & php 5 (not the Windows Installer) to c:\php4 & c:\php5 respectively
2. Setup the corresponding php.ini files in c:\php4 and c:\php5
3. Add the Web Service Extensions for php4 and php5. For php4 use c:\php4\sapi\php4isapi.dll, php5 use c:\php5\php5isapi.dll
4. Add the following registry keys:
HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5\IniFilePath -> c:\php5
HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath -> c:\php4
5. Add c:\php4 to the PATH environment variable.
6. Associate each web site in IIS with the corresponding php version.
Note: That should work, test with phpinfo() in each site. You may need to refer to the php documentation if we missed any other settings.