‹ Articles

How to Disable the PHP Opcache

PHP 5.5, 5.6, 7.0, 7.1, and 7.2 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

Last updated: April 25, 2017

Still Have Questions?

Don't hesitate to contact us if you can't find the answers to your questions.