Enabling WampDeveloper's PHP OPcache (OPcode Cache)

Posted: 2014-07-10 18:09:09

To enable the PHP’s OPcode cache extension “php_opcache.dll”:

1. Open PHP’s configuration file php.ini (Reliability Tab, click button: php.ini).

2. Near the bottom of the file find section “[Zend OPcache]”, and uncomment that section (remove the ‘;’ from each line).

This setting should already be set to “1”, which enables OPcache globally for all websites (…the other option is to only enable it for specific websites via their VirtualHost files):

* Be careful not to uncomment the plain-text lines (the real comments that explain things) or Apache might not start.

3. Open the website’s HTTP and SSL VirtualHost files (Websites Tab, select website, click buttons ‘HTTP VirtualHost’ + ‘SSL VirtualHost’). Remove, or comment out, this line:
php_admin_flag opcache.enable Off

* The above line might be inside both a “<IfModule php5_module>” (for PHP5) and “<IfModule sapi_apache2.c>” (for PHP4) blocks.

4. Save files (php.ini and VirtualHost files), and restart Apache for configuration changes to take effect. * Close and open WampDeveloper again to see changes in UI checkbox of Zend OPcache.


* There is a minor bug in the current release of Apache and/or PHP versions that makes phpMyAdmin eventually crash Apache while the PHP OPcode cache is enabled, unless you implement the fix shown here:

Edit file:

Comment out line (add ‘#’ in front):
php_admin_flag opcache.enable Off

* If you update your PHP scripts while the PHP OPcode cache is enabled, this configuration line in the “[Zend OPcache]” section will cause the previous results to remain for 60 seconds before your changes are displayed (which confuses a lot of developers when they don’t see the changes immediately):

* OPcache must be enabled globally (opcache.enable=1) when using PHP-FCGI, as in this case, it’s not possible to set this value via a website’s VirtualHost.