← ServerPilot Docs

How to Disable the PHP Opcache

PHP 5.5, 5.6, 7.0, 7.1, 7.2, 7.3, and 7.4 have a built-in opcache that is enabled by default.

The entire purpose of PHP's opcache is to speed up your scripts and save CPU by storing compiled PHP scripts in memory.

If you'd rather have slower apps and increased CPU usage to save memory, you can disable the opcache.

To disable PHP's opcache, you can SSH in as root and edit the following files:


Add the following line to the end of each of these files:


Finally, restart each PHP version by running the following command as root:

sudo service php5.5-fpm-sp restart
sudo service php5.6-fpm-sp restart
sudo service php7.0-fpm-sp restart
sudo service php7.1-fpm-sp restart
sudo service php7.2-fpm-sp restart
sudo service php7.3-fpm-sp restart
sudo service php7.4-fpm-sp restart
Last updated: July 7, 2019

Launch your first site in 5 minutes