View Complete Thread
  • DropPhone DropPhone

    360 Posts



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

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


    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.