Questions? Feedback? powered by Olark live chat software
Knowledgebase
Author Avatar

How To Install Zend OPCache on cPanel Servers

Written by: on 04 June 2016 05:49 PM 04 June 2016 05:49 PM

To get the best performance out of cPanel servers it is advisable to install Zend OPcache.

Installing Zend OPCache on cPanel Servers

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
phpize
whereis php-config 
# set the path below
./configure --with-php-config=/usr/local/bin/php-config
make
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: nano /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). Also note if there is already a zend_extension line loading ioncube loader, make sure you paste this BELOW that line:

zend_extension=/INSTALL LOCATION/opcache.so
opcache.enable=1
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
If xcache is installed, you should also comment all the xcache lines by putting a ; in front of them.

5. Press Ctrl O to save the file

6. Press Ctrl X to exit

7. Type: service httpd restart

8. Type: php -v

9. 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 it does not and gives an error about wrong version of the Zend API then you specified the incorrect PHP location in step 2. Go back to step 2 and when you type phpize, use the alternative location for php in your configure script.
(19 vote(s))
Helpful
Not helpful