Does Wincache and php_opcache.dll complement one another?RSS

4 replies

Last post Jul 08, 2019 03:08 PM by DropPhone

  • Does Wincache and php_opcache.dll complement one another?

    Jul 04, 2019 06:13 PM|plindgreen|LINK

    Does Wincache compliment php_opcache.dll ? Should both be enabled?

    Its my understanding php_opcache.dll alone is typically fine but adding wincache adds some new caching functionality and is recommended for windows servers.

    I'm using windows 2016/php 7.2/IIS10 for Wordpress
    The most recent php 7.2 wincache appears to be available here, I'm not sure if theres a newer version available: https://windows.php.net/downloads/pecl/releases/wincache/2.0.0.8/

    I see a similar post here but no definitive answer:
    https://forums.iis.net/t/1236918.aspx?Wincache+vs+opcache+coexist+Any+tuning+needed+

  • DropPhone DropPhone

    357 Posts

    Microsoft

    Moderator

    Re: Does Wincache and php_opcache.dll complement one another?

    Jul 04, 2019 10:11 PM|DropPhone|LINK

    plindgreen

    Does Wincache compliment php_opcache.dll ? Should both be enabled?

    For PHP 7.x versions, WinCache does not provide opcode caching.  Everyone should use Zend Opcache (php_opcache) now for opcode caching support.

    WinCache provides a shared-memory cache for files, user (variable) caching, and PHP session support.  The file caching is rather important for scenarios where the files read by the PHP scripts are across a network share, or if your server is using spinning media. (Previously mentioned here)

    plindgreen

    I'm not sure if theres a newer version available

    2.0.0.8 is the latest version.

    plindgreen

    Should both be enabled?

    First off, In my opinion, Zend Opcache should be enabled.  Always.  It should be the first extension you enable.

    After that, whether or not you enable WinCache depends on what you're doing, and your server configuration. 

    If your PHP code doesn't read from files very often, and doesn't have any session state, and all of site files are on SSD physically attached to the box, maybe you won't benefit from WinCache.

    However, If you're using WordPress, and you want to use the WinCache aware user-variable caching extension, then you should turn it on.

    If your site reads from files all the time, and you've configured those files to be on a network share (via SMB or NFS or whatever), then the file cache will definitely help you out.

    However, don't take my word for it.  You should experiment and performance test your site's behavior both with and without WinCache.

    History:

    Originally, in the PHP 5.2 days, WinCache was doing opcode caching, in addition to file caching, user (variable) caching, and PHP session support.  At that time, Zend Opcache didn't exist yet, and wasn't in the default PHP builds.

    I believe it was around PHP 5.4 or 5.5 that Zend Opcache was created.  And, by PHP 5.6, it was included in the main build/distribution package. By PHP 7.x, the Zend Opcache extension was relatively stable.  So, rather than having two teams building exactly the same thing, WinCache dropped its opcode cache from PHP 7.* versions of WinCache, with the guidance that everyone should use Zend Opcache.

    To this day, Zend Opcache isn't enabled by default in either the development or production "starter" .ini files in the main build distribution.  However, at this point, it really should be.  Opcode caching has an enormous, positive impact on performance of PHP.

  • Re: Does Wincache and php_opcache.dll complement one another?

    Jul 05, 2019 12:15 PM|plindgreen|LINK

    thank you for the excellent response smile

    I see in the Web Platform Installer wincache for php 7.3 (made mistake above indicating 7.2) was released june 30, 2019.

    I cannot find any websites to download the extension or documentation on this version.The following 2 sites appear to have outdated wincache downloads, surprisingly the MS site is not up to date https://www.iis.net/downloads/microsoft/wincache-extension  https://windows.php.net/downloads/pecl/releases/wincache/2.0.0.8/

    I used the WPI and installed both the 32 and 64 bit versions, and am uncertain which is which now, the 2 locations appears to be: C:\Program Files\PHP\v7.3\ext\ 

    C:\Program Files\IIS\Windows Cache for PHP

    Can anyone guess which is which? I looked at file properties but they both appear to be the same. The File version indicates 2.0.0.8 which is surprising seeing as its  a new release?

  • Re: Does Wincache and php_opcache.dll complement one another?

    Jul 05, 2019 06:52 PM|plindgreen|LINK

    WPI installed the 64 bit version to C:\Program Files\PHP\v7.3 , it installs all of php too !

    The WPI also provided a direct link to wincache (64bit) here:
    https://sourceforge.net/projects/wincache/files/wincache-2.0.0/wincachewpi-2.0.0.8-7.3-nts-vc15-x64.exe/download although i couldnt find the dll this way

  • DropPhone DropPhone

    357 Posts

    Microsoft

    Moderator

    Re: Does Wincache and php_opcache.dll complement one another?

    Jul 08, 2019 03:08 PM|DropPhone|LINK

    plindgreen

    WPI installed the 64 bit version to C:\Program Files\PHP\v7.3 , it installs all of php too !

    Yes.  The way the Web Platform Installer works, each product can specify dependencies (other products which must be installed before the product will work).  WinCache depends upon PHP, since part of installing WinCache is magically updating the php.ini, so that things Just Work™.

    If you want just the php_wincache.dll, you can install the developer bits, and then place them in your PHP's ext directory, and update your php.ini by hand.

    Developer bits are found out on SourceForge: https://sourceforge.net/projects/wincache/files/development/ .  Be sure to pick the WinCache that matches your PHP version and flavor.  If you try to mix-and-match, you're going to have a Bad Day™.