Zend opcache on Windows with multiple sites (multiple php installs)

Zend opcache on Windows with multiple sites (multiple php installs)

by David Aylmer -
Number of replies: 0

Firstly, this isn't exactly a moodle issue per se - but this might help someone. It affects both Apache and IIS.

Example: I have a two moodle sites running on the same IIS 7.5 server (with separate application pools running different installs of PHP)

If both application pools are running under the same identity (e.g. Network Service) the following behaviour occurs:

Enabling the zend opcache extension in one of the php.ini files works fine, but as soon as I enable the extension in both php.ini files the first site to serve a PHP page will work normally and the second site won't serve any php files. If you have opcache logging turned on you get: "Fatal Error Cannot create mutex" in the log.

It seems the opcache code shared_alloc_win32.c, function get_mmap_base_file creates and locks a file “C:\Windows\Temp\ZendOPcache.MemoryBase@<User.Name>” which makes it impossible to use Opcode caching under more than one install of PHP under the same user account.

I also tried using the opcache.mmap_base directive without luck.

Workaround: Use a different service account user for each application pool. (Not really a big problem, and possibly best practice anyway). Still annoying!

Further discussion

http://web.archiveorange.com/archive/v/vXyZUFW5zH2x6l17fB3r

 

Average of ratings: Useful (1)