Explore information related to php 8 enable opcache


Install PHP OPcache on Ubuntu 20.04 LTS - Step by step guide ?

This article covers the complete procedure for installing the PHP OPcache on your Ubuntu 20.04 LTS Focal Fossa system. In fact, OPcache is an Apache module for the PHP interpreter which is used to increase performance by storing precompiled scripts in shared memory space. It basically removes the need for PHP to load and parse scripts on each request.


How to Install and Configure PHP OPcache with Nginx ?

1. First, install the Nginx, PHP and other PHP extensions with the following command:

$ apt-get install nginx php php-fpm php-cli php-opcache php-mysql php-zip php-gd php-mbstring php-curl php-xml -y

2. Once all the packages are installed, verify the PHP version with the following command:

$ php -version

3. Next, you will need to enable the PHP OPcache by editing php.ini file.

$ nano /etc/php/7.4/fpm/php.ini

Uncomment the following lines:

opcache.enable=1
opcache.memory_consumption=128
opcache.max_accelerated_files=10000
opcache.revalidate_freq=200

Next, Save and close the file then restart Apache service to apply the changes:

$ systemctl restart nginx php7.4-fpm

4. You can now verify the PHP OPcache installation with the following command:

$ php -i | grep opcache

Read More




For Linux Tutorials

We create Linux HowTos and Tutorials for Sys Admins. Visit us on LinuxAPT.com

Also for Tech related tips, Visit forum.outsourcepath.com or General Technical tips on www.outsourcepath.com