Improve Php Performance in Centos By using Opcache

Lim Sing
Apr 27, 2021

It known as Zend Optimizer+, Opcache, which can help to improve server and applications performance. It work by pre-compiling script byte-code in shared memory, so it help removing the need for php to load and parse scripts on each client request.

  1. yum install php-opcache
  2. run php -v to ensure php has this extension, will show:
  1. vi /etc/php.d/10-opcache.ini
  2. enable all of these by uncomment them:
opcache.enable_cli=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1

4. service httpd restart or systemctl restart nginx

--

--