OPcache overview

Overview

OPcache is a caching engine built into PHP. When enabled, it dramatically increases the performance of websites that utilize PHP.

From php.net:

OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.

Enabling OPcache on a Shared, DreamPress, or VPS hosting plan

OPcache is already enabled by default.

Enabling OPcache on a Dedicated Server

OPcache is already compiled with PHP. To enable it on your site, create a php.ini file. In that file add the following:

zend_extension=opcache.so

How to check if OPcache is functioning

Checking in a phpinfo.php file

You can confirm if OPcache is functioning by creating and viewing a phpinfo.php file. View the following article for details:

If you do not see OPcache listed in the file, view the troubleshooting section in the PHP.ini article for assistance:

Checking via the command line

To see if the module was installed correctly, you can run the following commands. Just specify the full path to your desired version of PHP. You should see the OPcache settings appear:

[server]$ /usr/local/php83/bin/php -i | grep opcache

Runtime configuration options

View the following link for a list of available runtime configurations you can use:

Using OPcache with WordPress

DreamPress

OPcache is enabled by default which you can see in a phpinfo.php file as mentioned above.

WordPress plugin

The WP OPcache plugin is useful to flush OPcache easily.

See also

Did this article answer your questions?

Article last updated PST.

Still not finding what you're looking for?