Does Wincache and php_opcache.dll complement one another? RRS feed

All replies

  • User409000176 posted

    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)

    I'm not sure if theres a newer version available is the latest version.

    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.


    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.

    Thursday, July 4, 2019 10:11 PM
  • User295931569 posted

    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/

    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 which is surprising seeing as its  a new release?

    Friday, July 5, 2019 12:15 PM
  • User295931569 posted

    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- although i couldnt find the dll this way

    Friday, July 5, 2019 6:52 PM
  • User409000176 posted

    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™.

    Monday, July 8, 2019 3:08 PM