How To Install php-opcache on CentOS 8

In this tutorial we learn how to install php-opcache on CentOS 8. php-opcache is The Zend OPcache

Introduction

In this tutorial we learn how to install php-opcache on CentOS 8.

What is php-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. This eliminates the stages of reading code from the disk and compiling it on future access. In addition, it applies a few bytecode optimization patterns that make code execution faster.

We can use yum or dnf to install php-opcache on CentOS 8. In this tutorial we discuss both methods but you only need to choose one of method to install php-opcache.

Install php-opcache on CentOS 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache

After updating yum database, We can install php-opcache using yum by running the following command:

sudo yum -y install php-opcache

Install php-opcache on CentOS 8 Using dnf

If you don’t have dnf installed you can install DNF on CentOS 7 first. Update yum database with dnf using the following command.

sudo dnf makecache

After updating yum database, We can install php-opcache using dnf by running the following command:

sudo dnf -y install php-opcache

How To Uninstall php-opcache on CentOS 8

To uninstall only the php-opcache package we can use the following command:

sudo dnf remove php-opcache

References

Summary

In this tutorial we learn how to install php-opcache on CentOS 8 using yum and dnf.