I am trying to enable Opcache, but for some reason, after editing my php.ini file and restarting apache (even rebooting the server), it still does not get enabled. Running a test I can see that that the php files location:
Loaded Configuration File /etc/php5/apache2/php.ini
Within that file I have added:
zend_extension=/usr/lib/php5/20121212/opcache.so
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
The location of the zend extension was defined by locate opcache.so. This did not work. I then noticed that php was loading an additional file /etc/php5/apache2/conf.d/05-opcache.ini. In that file it looks like:
; configuration for php ZendOpcache module
; priority=05
zend_extension=opcache.so
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
However, after restarting apache it still will not enable. The following is in my phpinfo() output:
Opcode Caching Disabled
How can I get it to enable?
In the output from phpinfo()
, have a look at the .ini
files listed under:
Additional .ini files parsed
There may be something like
/usr/local/php5/php.d/20-extension-opcache.ini
Make sure opcache.enable=1
is set in this file.