One Site, two version of PHP and Wincache RRS feed

  • Question

  • User-255881495 posted


    Using IIS (v7), i have on site ( \DEV ), in this site two filder (Application)

    PHP53  (register with php 5.3)
    PHP54  (register with php 5.4)

    And for each Folder a link to source code of the same application (with a Mklink)

    I vould test my application with n versions of PHP, all is OK

    Now i try to set wincache, i use WebPlatform installer to install wincache for PHP53 and wincache for PHP54. I activate the extension in each PHP.ini, and now more Http 500

    Is it possible to set 2 wincache version on the same site, but for 2 application ?


    Tuesday, April 1, 2014 5:46 AM

All replies

  • User603723528 posted


    One way coul be to set different file endings to the php files and define different handlers to each file ending.

    - All files ended with *.php have the FastCgiModule "C:\Program Files (x86)\PHP\v5.3\php-cgi.exe".
    In the v5.3 you have the first version of wincache.

    - Alle files ended with *.php4 have the FastCgiModule "C:\Program Files (x86)\PHP\v5.4\php-cgi.exe".
    In the v5.4 you have the second version of wincache.

    The negative aspect is to rename some of you project fileendings that have to be php4. 


    Tuesday, April 1, 2014 6:50 AM
  • User2136107622 posted

    I don't know if someone can use two PHP version on one site.

    Friday, April 18, 2014 4:58 AM
  • User409000176 posted

    The key thing is you can only have one version of PHP handling the .php extension per worker process. 

    So, if you can set up two different sites, with two different application pools, you could change the handler mapping per site, such that site1 -> PHP 5.3, and site2 -> PHP 5.4.

    The previous suggestion of having a different file handler mapping would technically work, but Wincache would blow up heavily, since the opcode cache and cross-process shared memory structures are really specific to the version of PHP.  If you had two different Wincache versions under the same worker process, things would get ugly (and hard to diagnose) in a hurry...So, if you *do* try the duplicate mapping thing, please disable Wincache.



    Hope this helps!


    Friday, April 18, 2014 11:43 AM
  • User414374931 posted

    Indeed, using two PHP version for one site is not a good idea at all. You should separate the use of PHP for two different versions of the site.

    Wednesday, August 27, 2014 7:33 AM
  • User409000176 posted

    One addendum to this discussion:

    Since I first posted my response, I've learned there *are* tricks to getting two versions of PHP to work within the same worker process.

    It turns out you can have different handler mappings per web.config file.  And you can put a web.config file in any directory in your web site.  So, you could have two sub-directories in your site, with a different handler mapping for "*.php".  To do this, however, you have to change the overrideModeDefault for the "handlers" section to "Allow", and there is some danger in doing so, esp. if you're a hoster.  However, it *is* possible.

    Here's the trick to getting two different Wincache versions to safely ignore each other: You *must* set the Wincache.namesalt setting in the php.ini file, and the value of the namesalt *must* be unique for each version of PHP + Wincache you have installed on the box.  So, let's say you had two installed versions of PHP 5.4.* installed on the server; for example, different dot releases.  Even if they're using the same Wincache version, you'd still want to set the Wincache.namesalt in each of the php.ini files to a different value. 



    See: http://php.net/manual/en/wincache.configuration.php#ini.wincache.namesalt

    Wednesday, August 27, 2014 12:26 PM