OPcache is a PHP extension which improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request. The extension is built-in for PHP 5.5+ …but, if you are looking to improve PHP performance, the first step should be to use PHP 7+ which is twice as fast as PHP 5. In any case, using OPcache, will speedup scripts x2 to x3 faster!Try these PHP OPcache config tweaks...Click To Tweet
PHP oPcache Control Panels
- OCP by _CK_ (Recommended) – The first OPcache control panel available online. (see above screenshot)
- OPcache Status by rlerdorf -A one-page opcache status page for the PHP 5.5+ opcode cache.
- OPcache GUI by amnuts – OPcache statistics, settings and cached files. Provides real-time stats.
- PeeHaa’s OpCacheGUI – A nice alternative GUI for PHP’s OpCache.
- OPcache Dashboard by Carlos Buenosvinos – monitor OPcache with this dashboard.
Improve PHP performance with OPcache config tweaks
If you’d like to improve PHP performance even more with OPcache, try applying some of all of the below changes to your php.ini or opcache.ini config file. (Performance gains most noticeable on higher throughput servers):
opcache.revalidate_freq = 10 (default "2") How often (in seconds) to check file timestamps for changes to the shared memory storage allocation. ("1" means validate once per second, but only once per request. "0" means always validate)
opcache.fast_shutdown = 1 (default "0") If enabled, a fast shutdown sequence is used for the accelerated code The fast shutdown sequence doesn't free each allocated block, but lets the Zend Engine Memory Manager do the work.
opcache.file_update_protection = 0 (default "2") Prevents caching files that are less than this number of seconds old. It protects from caching of incompletely updated files. In case all file updates on your site are atomic, you may increase performance setting it to "0".
— If you are on WordPress you can use this OPcache WordPress plugin.
— PHP OPcache page: http://php.net/manual/en/book.opcache.php
— List of PHP accelerators: https://en.wikipedia.org/wiki/List_of_PHP_accelerators