By cj on Mar 15, 2013
Zend have contributed their Zend Optimizer+ opcode cache to PHP - thanks Zend!!! (Update 19 March 2013: the renaming to "Zend OPcache" is complete)
"The Zend OPcache provides faster PHP execution through opcode caching and optimization."
The new OPcache extension can be seen as substitute for the venerable APC cache, the maintenance of which had become an issue. Note: although OPcache is now readily available, there is currently nothing preventing you from using any available (working!) opcode cache in PHP 5.5.
A few minutes ago Dmitry Stogov did the physical merge to the PHP
ext/opcache directory. The current PHP 5.5 snapshot has the code.
Future Alpha or Beta (and Production) releases will include it
Please test OPcache. It is not a panacea for all performance problems. There are a lot of settings which may need adjusting. Understanding how it works and identifying issues during the stabilization phase of PHP 5.5 release process will greatly help.
To build Zend OPcache for PHP 5.5:
When you configure PHP, add the option
./configure ... --enable-opcache
make install, as normal. This
will build OPcache shared extension. It's not possible to build it
Find the shared library in your installation directory with a command like
find /home/cjones/php55 -name opcache.so
php.ini and add the extension with its full path:
Update (25 March 2013): Dmitry merged a PHP 5.5 change so that the full path is not required for
zend_extension libraries in the
extension_dir directory. You can now simply do
You'll want to enable OPcache too:
The ext/opcache/README is the current source of documentation, and
lists all the other
Problems can be reported in the Github issue tracker
Update (18 March 2013): In a commit over the weekend, the build option
--enable-opcache is On by default. You will still need to update php.ini.
To build Zend OPcache for older versions of PHP:
You should be able to build OPcache with PHP 5.2 onwards
The new opcode cache does not include a user-data cache. Joe Watkins recently started the APCu project to extract the user-data cache code from APC. Test this too!