Overview
This article explains how to enable OPcache and check if it's functioning on your site.
Background
OPcache is a caching engine built into PHP. When enabled, it dramatically increases the performance of websites that utilize PHP. You can read more about Opcache 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.
How to enable OPcache
The following sections provide information on how to enable OPcache on specific DreamHost plans.
Shared, DreamPress, or VPS
OPcache is already enabled by default on Shared, DreamPress, and VPS hosting plans.
Dedicated Server
OPcache is already compiled with PHP. To enable it on your Dedicated Server site, create a php.ini file and add the following:
zend_extension=opcache.so
WordPress and DreamPress
You can use OPcache with either WordPress or DreamPress:
- DreamPress — OPcache is enabled by default, which you can see in a phpinfo.php file as described below.
- WordPress plugin — The WP OPcache plugin is useful to flush OPcache easily.
How to check if OPcache is functioning
There are a few different ways you can check if OPcache is functioning, which are described in the following sections.
Checking with a phpinfo.php file
You can confirm if OPcache is functioning by creating and viewing a phpinfo.php file. See this article for further details.
If you do not see OPcache listed in the file, see this article for guidance.
Checking via the command line
To see if the module was installed correctly, you can run the following command. Just specify the full path for your desired version of PHP:
[server]$ /usr/local/php83/bin/php -i | grep opcache
You should see the OPcache settings appear.
Using a runtime configuration
See this page for a list of available runtime configurations you can use.
See also
DreamHost links