Get your server issues fixed by our experts for a price starting at just 25 USD/Hour. Click here to register and open a ticket with us now!

Author Topic: Install ZendOpcache on CentOS  (Read 1202 times)

0 Members and 1 Guest are viewing this topic.

vyshakhv

  • Newbie
  • *
  • Posts: 28
  • Karma: +0/-0
Install ZendOpcache on CentOS
« on: April 07, 2018, 04:27:18 pm »
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. This extension is bind to PHP 5.5 and higher version. But, for PHP Versions 5.2, 5.3 and 5.4 it can be installed manually using PECL installer.

Check the release version of your server -
Code: [Select]
cat /etc/redhat-release
Download ZendOpcache and Install
Code: [Select]
cd /usr/local/src
wget http://pecl.php.net/get/ZendOpcache
tar xvfz ZendOpcache
Go to ZendOpcache directory and run the installer script
Code: [Select]
cd zendopcache-7.0.5/
phpize
./configure
make
make install
A successful installation will create "opcache.so" file into the PHP extensions directory. Copy the location path of opcache.so file and put it into php.ini file. Paste code in php.ini file -
Code: [Select]
nano /usr/local/lib/php.ini

zend_extension=/usr/local/lib/php/extensions/no-debug-non-zts-20100525/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

Save the file and check using php -v. This should show you that Zend OPcache is enabled.