Linux Administrator

How to Install OPCache on CentOS 7

Previously OPCache was know as Zend Optimizer+. PHP 5.5 introduced opcace caching into the core via OPCache. OPCache is also available as an extension through pecl, and is compatible all the way back to PHP 5.2.

In this article I will show you how to install Opcache on CentOS 7.

How does Opcache work?

Each time a PHP script is requested, the PHP script will be parsed and compiled into opcode which at that point is executed in the Zend Engine. This is the thing that enables PHP designers to avoid the assemblage step required in different languages like Java or C# — you can roll out improvements to your PHP code and see those progressions quickly. Be that as it may, the parsing and arranging steps increment your response time, and in a non-improvement condition are frequently pointless, since your application code changes occasionally.

Opcache Installation

First of all you have to install EPEL and REMI repository on your system because Remi’s packages depends on some EPEL packages. Follow the below link to install the both repository on your system.

Next install yum-utils which contain yum-config-manager that will be helpful to enable repo.

# yum -y install yum-utils

Once yum-utils installed on your system. Lets go to enable php 5.6 the repository.

# yum-config-manager --enable remi-php56

Now proceed to update php to 5.6

Be careful if you update your current PHP version this may break your site. First test it on your development server if everything is fine then go to production server.
# yum update -y

Verify that php is update using below command.
# php -v

Now restart your web server and check that all sites are functional.

# service httpd restart

Next, it is time to install php OPCache using below command.

# yum -y install php-opcache

Now again restart your web server to apply the changes.

# service httpd restart
Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.


Leave a Comment