OPcache Extension is Always Available in PHP 8.5

OPcache Extension is Always Available in PHP 8.5

The OPcache extension boosts PHP performance by caching precompiled script bytecode in memory, removing the need to load and parse scripts on every request. OPcache has become a crucial part of PHP, and running PHP in production without it is generally considered as a significant misconfiguration.

In versions before PHP 8.5, PHP could be compiled without the OPcache extension by using the --disable-opcache option:

./configure --disable-opcache

Since PHP 8.5, the OPcache extension is always included in PHP core. There is no longer any way to run PHP without it or accidentally omit its installation, a problem that commonly occurred with Docker containers based on the official PHP image. The goal is to simplify maintenance and avoid misconfigurations.

The opcache.enable and opcache.enable_cli directives are supported, which means OPcache can be disabled in specific scenarios. However, the extension is always included in PHP, even when it is turned off at runtime.

Leave a Comment

Cancel reply

Your email address will not be published.