Enable Zend OPcache in PHP

To enable Zend OPCache in PHP, edit php.ini add following to end of the file

zend_extension=opcache.so

Now you may need to adjust some settings, in php.ini uncomment following, change values as needed.

opcache.enable=1
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.validate_timestamps=1
opcache.revalidate_freq=10

Verify it with

[root@vps154294 php]# php -m | grep  Zend
Zend OPcache
[Zend Modules]
Zend OPcache
[root@vps154294 php]# 

Restart web server. If you using php-fpm or fcgi, you need to restart the process.

phpinfo() will show

Zend OPcache in phpinfo

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *