LockedMultiple PHP Support

Author
Dhosting.co.uk
Premium Member
2007/03/22 18:11:28 (permalink)

Multiple PHP Support

Right guy's

Below are instructions for making php 5.2 work along side 5.1 or any other branch below that.

So HC, to make this work you need to add another php path setting so the host admin can select the second php installation folder. You can also use two php 5.1 or 4.X but one has to run in cgi mode, once i have tested my instructions for this i will post them in this section, it might be better if hc support adding multiple php versions not just a limited 2 or 3, dont see it being to hard to be honest!

Anyways i have this setup running on two servers, i used the php5.2-win32-200703230030 snapshot as it has several fixes for 5.2.1 bugs which have been causing us lots of issues :)

---------------------------------------------
Here's how to run dual PHP instances with PHP 5.2 and any previous PHP on Windows 2003:

1. Right-click My Computer, go to Advanced tab, and click on Environment Variables.

Add the two installations to the Path variable. For example, add:
c:\php;c:\TMAS\php;

Then, add the PHP 5.2 version's directory as a variable called PHPRC. For example:
Variable:PHPRC
Value: C:\PHP

Click OK to close the Environment Variables window, and click OK to close System Properties.

2. In registry, under HKEY_LOCAL_MACHINE>SOFTWARE>PHP, add a REG_SZ key called iniFilePath and give it a value
of the directory where the older PHP is installed. For example:
C:\TMAS\PHP

3. In IIS, go to the Web Service Extensions. Add both versions' ISAPI module separately to the extensions
list, and allow both.

4. Once you have added the extension restart IIS

5. In IIS, go to each website utilizing the PHP versions. Set an ISAPI filter if needed. On the Home Directory
tab, click Configuration, alter the php extension to use the isapi file in the php folder of your choice

6. You will need to restart the website once you have changed the php version on the website in question, this stops any cache issues etc.

You can now run two versions of PHP. This is because the order of where to look for the .ini file changed
between previous PHP versions and PHP 5.2, as documented at http://us2.php.net/ini:

---------------------------------------------------
php.ini is searched in these locations (in order):

* SAPI module specific location (PHPIniDir directive in Apache 2, -c command line option in CGI and CLI, php_ini parameter in NSAPI, PHP_INI_PATH environment variable in THTTPD)
* The PHPRC environment variable. Before PHP 5.2.0 this was checked after the registry key mentioned below.
* HKEY_LOCAL_MACHINE\SOFTWARE\PHP\IniFilePath (Windows Registry location)
* Current working directory (for CLI)
* The web server's directory (for SAPI modules), or directory of PHP (otherwise in Windows)
* Windows directory (C:\windows or C:\winnt) (for Windows), or --with-config-file-path compile time option
----------------------------------------------------

__________________
Chris Daley
Dwebs Ltd Director :: Company No. 05603664 :: Phone No. (UK) 0870 803 4423
www.Dhosting.co.uk - Web Hosting, Domain Registration
www.Dwebs.ltd.uk - Web Design & Other Services
My views are my own and not those of my company.
#1

0 Replies Related Threads

    Jump to: