If your running PHP on Windows and using PHP 5.5+ including PHP 7+ the Zend OPcache comes built in by default but isn’t enabled.
You will get massive improvements on any sequential execution of a PHP pages and there is really no reason not to use the Zend OPcache.
So lets enable the PHP OPcache and gain a whole lot of PHP speed!
- Open your PHP.INI file in a text editor like notepad. Depending how you installed PHP with could be in your program files under the php version but it could be easier to just find it.
- Check that the extension directory is configured by making sure that “extension_dir” has been set. Typically this line should read: extension_dir = “ext”
- Go the the end of the PHP and on a new line add: zend_extension=php_opcache.dll
- Restart IIS or Apache
- Enjoy faster PHP
You may want to confirm that the above has worked and the easiest way to do this is by creating a PHPInfo file and confirming that “with Zend OPcache” is shown under the Zend Engine line.
And further down the page the “Zend OPcache” section should now exist and show that it’s “Up and Running” like below:
There are also lots of other good stats shown, as you refresh the cached pages this section (after a refresh) will show stats on how well the OPcache is working.