How To Install php-opcache on Rocky Linux 8

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

Introduction

In this tutorial we learn how to install php-opcache on Rocky Linux 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 Rocky Linux 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 Rocky Linux 8 Using dnf

Update yum database with dnf using the following command.

sudo dnf makecache --refresh

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

sudo dnf -y install php-opcache

Install php-opcache on Rocky Linux 8 Using yum

Update yum database with yum using the following command.

sudo yum makecache --refresh

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

sudo yum -y install php-opcache

How To Uninstall php-opcache on Rocky Linux 8

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

sudo dnf remove php-opcache

php-opcache Package Contents on Rocky Linux 8

/etc/php.d/10-opcache.ini
/etc/php.d/opcache-default.blacklist
/usr/lib/.build-id
/usr/lib/.build-id/a6
/usr/lib/.build-id/a6/9d7c11c84bb54167a606840a381117e83d625d
/usr/lib64/php/modules/opcache.so

References

Summary

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