Single Blog

How to install and configure PHP Zend Opcache

January 18, 2017, Written by 0 comment

What is Opcache you ask?

Opcache is a PHP extensions that will help to improve server & applications performance. There are many popular opcode caches like eaccelerator, xcache, apc, etc.  Opcache is recommended in almost all App and Server production environments as a method of caching and handling PHP tasks. All you need is disk or memory space in order to store the cached data. If you’re using a VPS, check out our SWAP tutorial.

EPEL Repository Required for Opcache

CentOS 7 (including EPEL install)

rpm -Uvh remi-release-7*.rpm epel-release-7*.rpm

If you already have EPEL installed:

rpm -Uvh remi-release-7*.rpm

CentOS 6 (including EPEL install)

rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm

If you already have EPEL installed:

rpm -Uvh remi-release-6*.rpm

Install Zend Opcache on CentOS / RHEL / Fedora

yum install php-opcache

Edit the opcache.ini file:

nano -w /etc/php.d/opcache.ini

The basic configuration currently used on our VPS 0.5 package. You can increase the Max Accelerated Files to a higher number such as 10k if you desire.

; Enable Zend OPcache extension module

; Determines if Zend OPCache is enabled

; Determines if Zend OPCache is enabled for the CLI version of PHP

; The OPcache shared memory storage size.

; The amount of memory for interned strings in Mbytes.

; The maximum number of keys (scripts) in the OPcache hash table.
; Only numbers between 200 and 100000 are allowed.

; If enabled, a fast shutdown sequence is used for the accelerated code

;following can be commented for production server

Restart Apache or Nginx and Opcache will start to make a difference straight away!

James Ensor