Matomo Analytics

Documentation

How does OPcache work?

OPcache is a caching mechanism for PHP code, it will cache compiled PHP code so it is not compiled on each runtime. Ploi automatically installs OPcach...

OPcache is a caching mechanism for PHP code, it will cache compiled PHP code so it is not compiled on each runtime. Ploi automatically installs OPcache for you so you only have to press one button to enable this feature. You can find this button in your server view > PHP tab:

Enable OPcache

The speed of your website will significantly increase if you have a PHP project, but there is one important thing to remember:

Whenever you enable OPcache, the code is cached and kept cached in the FPM worker. So if you deploy a new version of your website, the changes will not come through because the old code is still cached. This means you have to tell the FPM worker to clear its cache.

Clearing the FPM cache is easy: add this line at the end of your deploy script:

echo "" | sudo -S service php8.5-fpm reload

Change 8.5 to the PHP version you have.

For more information about OPcache, we refer you to the original PHP website.

Dennis Smink

Written by Dennis Smink

Dennis brings over 13 years of hands-on experience in server management, specializing in optimizing web services for scalability and security.

Ready to dive in?
Start your free trial today.

Create an account and enjoy your 5-day free trial — no credit card required.

Start your free trial