Windows Cache Extension for PHP caches the relation between relative and absolute file paths, reducing the number of relative path resolutions performed by the PHP engine. PHP applications that use many relative paths would perform faster given the conversion to absolute paths is performed only once. The most crippling bottleneck for many PHP-based software is almost always related to memory consumption. The PHP command interpreter does an excellent job for any low-traffic website, but when your WordPress blog (or Joomla! commercial website) jumps out of the unknown and really starts to hit the mark, you can bet you will soon face the issue: pages becoming slower, requests hanging out and often reaching the 503 - Service Unavailable or other timeout errors, and other stuff that will drive crazy your monitor tools like Yslow (if you don't use it yet, you better start now!), Analytics and so on To drastically improve the performance of any high-traffic PHP website running under IIS you can consider installing one of the free caching PHP extension tools available: in this post we'll cover the Microsoft one, namely WinCache, which is included in all the base PHP installation packages for Windows since version 5.2. This neat extension grants a serious performance boost thanks to a five-level caching mechanism:
Installing WinCache is fairly easy. The first thing you need to do is to check whether the php_wincache.dll file is included in your PHP installation or not. This file is located in the /ext/ subfolder of your PHP installation folder. If it's not there, you can download it manually from the WinCache official website (just be sure to pick the file matching your PHP version), unpack it and copy the .dll file to the aforementioned folder. Then you need to enable the WinCache extension to your PHP installation by adding the following two lines to your php.ini file, which is usually located in your PHP installation folder OR in the Windows root folder: 1 2 [PHP_WINCACHE] extension=php_wincache.dll IMPORTANT: Before you do that you might want to check if the extension is already enabled by doing a quick text search for "php_wincache.dll" inside the file. If you're using PHP Manager for IIS (which you really should) you could also install the WinCache extension directly from the PHP Manager GUI. If you're NOT using PHP Manager for IIS and/or you have no idea of where your php.ini file actually is, you can easily track it by executing the phpinfo() command on your server (if you don't know how, just click here to download a sample script, put it on your server and execute it): as soon as you did that you can review your whole PHP configuration, which contains the full path of the currently Loaded Configuration File: That same phpinfo() command can be also used to check whether the WinCache extension has been properly installed or not. If that's the case you will be able to see something like that by scrolling down a little: In most cases, like the screenshot above, the system will tell you that all the caches are currently disabled: this is perfectly normal, since we didn't activate any of them yet.In order to do so we need to add some additional configuration settings to our php.ini file: Shell1 2 3 4 5 6 7 8 9 10 11 12 [WinCache] ; Full reference: http://php.net/manual/en/wincache.configuration.php wincache.fcenabled = 1 wincache.ocenabled = 1 wincache.ucenabled = 0 wincache.fcachesize = 64 wincache.fcndetect = 1 wincache.maxfilesize = 256 wincache.chkinterval = 10 wincache.enablecli = 1 wincache.ucachesize = 8 wincache.scachesize = 8 These settings are generally OK for most production environments. You can fine-tune them by taking a look to the WinCache reference guide, where you will find a detailed description of any possible configuration setting to adapt WinCache to your needs. When you think you're done, save the php.ini file and restart IIS: you'll be able to check the results of your hard work by executing the phpinfo() command again: |