IIS7 + two PHP versions (with *two* different PHP.INI files)RSS

1 reply

Last post May 27, 2014 09:02 AM by Jan Reilink

  • IIS7 + two PHP versions (with *two* different PHP.INI files)

    May 26, 2014 12:40 PM|ilnebbioso|LINK

    Hello, all.

    I've got a question for all of you which is making me crazy.

    I was able to have *two* different PHP versions (5.5.10 and 5.4.28) for two websites into the same Windows Server. But, both of them use the same PHP.INI file and I'm not able to understand why.

    In fact, if I look into the two phpinfo.php I see:

    WEBSITE A 

    • PHP Version 5.5.10
    • Configuration File (php.ini) Path C:\Windows
    • Loaded Configuration File C:\Program Files (x86)\PHP\php.ini
    • In Environment: "PHPRC C:\Program Files (x86)\PHP\"

    WEBSITE B

    • PHP Version 5.4.28
    • Configuration File (php.ini) Path C:\Windows
    • Loaded Configuration File C:\Program Files (x86)\PHP\php.ini
    • In Environment: "PHPRC C:\Program Files (x86)\PHP\"

    As you can see I have these two rows which are wrong, IMHO:

    • Loaded Configuration File C:\Program Files (x86)\PHP\php.ini
    • In Environment: "PHPRC C:\Program Files (x86)\PHP\"

    Into WEBSITE B I expect: "Loaded Configuration File C:\PHP5.4.28\php.ini".

    In both WEBSITE A & B I expect In Environment the "PHPRC" value empty or different in WEBSITE B.

    We have a:

    • Windows Server 2008 SP2 with all updates installed
    • main installed PHP php-5.5.10-nts-Win32-VC11-x86 with Installer
    • second installer of PHP 5.4.28, installed manually as (for example) described here: http://ruslany.net/2009/12/multiple-php-versions-on-the-same-iis-server/#iis70

    I verified the PHPRC in System->Advanced Settings->Environment Variables->System variables, which was REMOVED. Also verified by CMD > SET that there isn't any PHPRC parameter. 

    After that, I also added into regedit the expected values as explained here: http://www.php.net/manual/en/configuration.file.php

    I also rebooted the server.

    I expect that the two websites use the [HKEY_LOCAL_MACHINE\SOFTWARE\PHP\x.y.z] values:

    • HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5.5.10\IniFilePath [REG_SZ] C:\Program Files (x86)\PHP
    • HKEY_LOCAL_MACHINE\SOFTWARE\PHP\5.4.28\IniFIlePath [REG_SZ] C:\php5.4.28
    • HKEY_LOCAL_MACHINE\SOFTWARE\PHP [REG_SZ] C:\php5.4.28

    But these values aren't what I receive back.

    What's wrong? I'm ready to give all the needed details.

    Thank you very much for your help and support since now!

    2008 php.ini php PHPRC

  • Re: IIS7 + two PHP versions (with *two* different PHP.INI files)

    May 27, 2014 09:02 AM|Jan Reilink|LINK

    You may only use one php.ini per applicationpool. Perhaps my answer on Servervault might give you some insights: http://serverfault.com/questions/593490/secure-php-on-iis-8-5/598164#598164 (the question was "Secure PHP on IIS 8.5"). We use this to run 3 different PHP versions, with a total of 7 php.ini files, all useable for hosted websites.

    2008 php.ini php PHPRC

    Vevida: https://vevida.com
    Sysadmins of the North: http://www.saotn.org