What is OPcache?
⛔️ Deprecated: This information applies only to WP Rocket versions prior to 3.10.8.
If your server has PHP 5.5 or higher, you will see an in the admin bar to Purge OPcache.
You can read on the PHP manual to know more about OPcache:
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.
In other words, a PHP script when it is executed, is compiled into opcode, code that is understandable by the machine. OPcache stores this code into memory on the first execution, to be reused afterwards, thus leading to performance boosts.
OPcache replaces APC, and is an alternative to XCache, as a PHP accelerator.
WP Rocket enables you to reset the OPcache content easily if needed right from your WordPress admin bar.
The OPcache is not cleared automatically when you click Clear Cache button because it rarely has to be cleared.
I don't see the Purge OPcache link
If you don't have this option in the WP Rocket admin toolbar it means either:
- Your server hasn't been configured to use OPcache
~ or ~
- Clearing the OPcache via API isn't possible because of this restriction in php.ini:
opcache.restrict_api
In either case, talk to your host or server admin to enable these features.
I'm getting an "OPcache purge failed" message
WP Rocket currently supports the purge of memory-based OPcache.
If your host is using file-based OPcache, purging will not work, and the "OPcache purge failed." message will be displayed.
Contact your host, and ask them if they are using file-based OPcache. In case they do, the following WordPress plugin can clear both memory-based, and file-based OPcache:
https://wordpress.org/plugins/flush-opcache
If your site is hosted on SiteGround, the OPCache cannot be purged using any plugin because the folder it's stored in isn't accessible to plugins.