Zend OpCache

The Zend OpCache provides faster PHP execution through opcode caching and optimization. It improves PHP performance by storing precompiled script bytecode in the shared memory.

Installing Zend OPCache on PHP 5.3 or 5.4

1. Login to SSH on your server

2. Type the following commands:

#cd /usr/local/src

#wget http://pecl.php.net/get/ZendOpcache

# to get the latest (master) build do the following instead:

# wget https://github.com/zendtech/ZendOptimizerPlus/archive/master.zip

#tar -xvfz ZendOpcache

#cd zendopcache-7.x.x


#whereis php-config

# set the path below

#./configure –with-php-config=/usr/local/bin/php-config


#make install

3. Wait for the installation to complete. At the end it will tell you the location it has placed the file opcache.so. Ensure you have this location to your clipboard.

4. Type: vi /usr/local/lib/php.ini

5. Scroll down until you find the listing extension_dir = “/usr/local/lib/php/extensions/no-debug-non-zts-XXXXXXXX”

6. Paste this in on a new line (make sure you replace the INSTALL LOCATION with the correct location from step 3):

zend_extension=/INSTALL LOCATION/opcache.so








If xcache is installed, you should also comment all the xcache lines by putting a ; in front of them.

7. Save and exit

8. Type: service httpd restart

9. Type: php -v

10. This should show you that Zend OPcache is enabled.

PHP 5.4.3 (cli) (built: Jan 12 2014 20:27:27) 
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.5.0, Copyright (c) 1998-2013 Zend Technologies
    with Zend OPcache v7.0.3-dev, Copyright (c) 1999-2013, by
Zend Technologies

If you require help, contact SupportPRO Server Admin

Server not running properly? Get A FREE Server Checkup By Expert Server Admins - $125 Value

Leave a Reply