Last updated on

Opcode Caching 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. It is always a good idea to have Opcode Caching enabled as this functionality cannot be disabled, though when enabled it will report the actual state and (in the Pro version) statistics.

In production environments, you may have slightly better performance by disabling the “Validate timestamps” option under General Settings > Opcode Cache. If you are using PHP-FPM, you may not be able to disable this in W3 Total Cache.

When this option is disabled, files will not be recompiled on PHP file updates, such as when the file modification time changes, and will only be recompiled on PHP restart.

Choosing a Method

PHP 5.5.0 or later comes with Zend Opcache, which is considered to have deprecated alternatives such as APC / APCu due to its much better performance. Because Zend Opcache is included with modern versions of PHP, it is already present and active, meaning that enabling Opcode Caching with Zend Opcache as the selected method will enable tracking and reporting statistics

Zend Opcache (Generally Recommended)

Zend Opcache is the Opcode caching implementation included with PHP 5.5.0 and later. Its performance is generally considered to be much faster and more efficient than APC-based Opcode caching.

Alternative PHP Cache (APC)

APC refers to Alternative PHP Cache which provides in-memory Opcode caching and a key-value store for looking up cached items. This is largely deprecated in favor of modern Opcode Caching mechanisms, as APC is not supported in the PHP 7.x branch.

APC is not stable when a lot of memory allocated. In cases where you are caching a small amount of data, APC may be the ideal method for single-instance hosting platforms such as VPS or Dedicated hosting.

Caveats

APC allows a userland-shared memory cache which may be ideal for multi-tenant scenarios, though this functionality is also available in APCu which is compatible with the PHP 7.x release branch.

W3 Total Cache

You haven't seen fast until you've tried PRO

   Full Site CDN + Additional Caching Options
   Advanced Caching Statistics, Purge Logs and More

Everything you need to scale your WordPress Website and improve your PageSpeed.

2 thoughts on “Choosing an Opcode Caching Method with W3 Total Cache

  1. Hi, the Opcode Cache dropdown says unavailable and will not allow me to select Zend Opcache.

    Not sure what to do here. Could you explain please

    thank you

Leave a Reply

Your email address will not be published. Required fields are marked *