OPcache is a PHP feature that remembers your site’s code in a ready-to-run form, so PHP does not have to prepare it again for every visitor. A WordPress page is built from dozens of files, so remembering them saves a lot of repeated work.
What is OPcache?
OPcache is a built-in PHP extension that keeps compiled scripts in memory, so PHP does not have to read and compile them on every request.
PHP does not run your source files directly. It first compiles each file into an intermediate form and then executes that. Without a cache, this happens again for every request and every file.
OPcache stores the compiled result in shared memory, so the next request can skip the compile step.
The effect is that the same site uses less processor time per page view and answers faster, without any change to the code. It is not a page cache. It does not store finished pages, only the compiled code that produces them.
The settings that matter
A few settings in php.ini decide how OPcache behaves. opcache.enable turns it on. opcache.memory_consumption sets how much memory it may use. opcache.validate_timestamps and opcache.revalidate_freq control how often it checks whether a file has changed. On production servers, some hosts switch off timestamp checks for speed, which makes a reset necessary after each code change.
OPcache and your WordPress site
Which PHP version does your site report?
We read only what your site already sends in public: the headers and the top of the homepage. No scan, no login.
Most of the time you will not notice OPcache, and that is the point. You notice it in two situations. The first is when a site is slow and OPcache is off or too small.
The second is when you update plugins or core files and the old behavior seems to stay, because the cache still holds the old compiled version.
During a PHP version update the cache is also relevant. Each PHP version has its own OPcache, and a restart of PHP-FPM empties it. After a switch, the first requests are slower while the cache fills again.
How to check OPcache
Open a phpinfo page and look for the section “Zend OPcache”. It shows whether it is enabled, how much memory is used and how many scripts are cached. Some hosting panels show the same in the PHP settings.
Remove the phpinfo page afterwards.
If it is disabled, ask your host to enable it. If the memory is nearly full, ask for a larger allocation. Do not tweak the values blindly on a shared server, because the right numbers depend on how many files your sites load in total.
When to act
Look at OPcache when pages are slow for no clear reason, after a PHP update, or when changes to code do not show up. Treat it as one part of the picture, together with your PHP version and your hosting. A newer PHP branch is usually faster, and our PHP upgrade service takes care of the version and of checking that the cache works after the switch.
Not sure how this applies to your site?
Ask a person to take a look. We check which PHP version your site runs and whether the fix is in, and tell you the next step.
Or have PHP updated right away: PHP update from $555 excl. VAT
Frequently asked questions
Is OPcache the same as a page cache?
No. OPcache stores compiled PHP code. A page cache stores finished pages.
They work at different levels and can be used together.
Is OPcache turned on by default?
OPcache ships with PHP, but it only works when the extension is loaded and enabled in the configuration. Most hosts take care of that. Check the phpinfo page for the OPcache section to be sure.
Why do I still see old code after an update?
OPcache may still hold the old compiled version of the file. A reload of PHP-FPM or an OPcache reset clears it. Some hosts do this automatically after a deployment.
Can OPcache cause errors?
Rarely. If the memory reserved for OPcache is too small, it fills up and performance drops. The phpinfo page and your host's tools show how full it is.