OPcache is a caching feature built into PHP. Normally, PHP has to translate (compile) your website's PHP files into machine-readable code every single time a page is requested. OPcache stores that compiled code in memory after the first request, so later visits skip the recompiling step entirely. For most PHP sites, including WordPress, this is one of the simplest ways to reduce page load time with no code changes required.
OPcache is usually available on your hosting account already. You just need to switch it on for your domain's PHP configuration.
How to Turn On OPcache
In cPanel
- Log in to cPanel.
- Under the Software section, click Select PHP Version.
- Click the Extensions tab.
- Find opcache in the list and tick its checkbox.
- Click Save.
If you want to fine-tune it further, open MultiPHP INI Editor (also under Software), select your domain, and adjust directives such as opcache.memory_consumption (how much memory it's allowed to use) or opcache.validate_timestamps (whether it automatically checks for file changes).
In DirectAdmin
- Log in to DirectAdmin.
- Under Advanced Features, click Select PHP Version.
- Switch to the Modules (or PHP Extensions) tab.
- Tick the opcache checkbox.
- Click Save.
If you update a plugin, theme, or script and your changes don't seem to appear right away, it's rarely a sign OPcache is broken. By default, OPcache checks file timestamps and refreshes its cache automatically within a few seconds, so you usually don't need to disable it or restart anything while making routine edits. If you ever need changes to reflect instantly during active development, you can temporarily uncheck the opcache extension, make your edits, then re-enable it once you're done.
For more on managing PHP settings for your site, see How to Check and Change Your Website's PHP Version.