OPcache 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 or DreamPress hosting plan

OPcache is already enabled by default.

Enabling OPcache on a VPS hosting plan

  1. Navigate to the (Panel > ‘Domains’ > ‘Manage Domains’) page.
  2. Click the Edit button to the right of your domain under the ‘Web Hosting’ column.
    Enabling_OPcache
  3. Scroll down to the ‘Web Options’ section and check the box next to 'PHP OpCache Support'.
  4. Scroll down and click the blue Change settings button to save your changes.

Enabling OPcache on a Dedicated or DreamCompute plan

If you are using a Dedicated or DreamCompute hosting service, follow the instructions below to enable it manually.

OPcache is already compiled with PHP 5.6 and 7.0. To enable it on your site, create a PHP.ini file. In that file add the following depending on which version of PHP you're using:

PHP 5.6

zend_extension=/usr/local/php56/lib/php/extensions/no-debug-non-zts-20131226/opcache.so

PHP 7.0

zend_extension=/usr/local/php70/lib/php/extensions/no-debug-non-zts-20151012/opcache.so

PHP 7.1

zend_extension=/usr/local/php71/lib/php/extensions/no-debug-non-zts-20160303/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:

When viewing your phpinfo.php file, you should see the following:

OPcache.png

If you do not see OPcache listed, 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 command. You should see the OPcache settings appear:

[server]$ php-7.1 -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 has replaced XCache for all DreamPress sites. OPcache is enabled by default which you can see in a phpinfo.php file as mentioned above.

WordPress plugin

The OPcache Dashboard plugin is useful to reset OPcache when WordPress has updated. It also allows you to view how much memory OPcache is currently using.

See also

Did this article answer your questions?

Article last updated .