PHP 8.4: Opcache: INI changes on how JIT is enabled

Version8.4
TypeChange

PHP 8.0 added support for Just-In-Time compilation to PHP. JIT is disabled by default, and there are two toggles, opcache.jit and opcache.jit_buffer_size that controlled the main functionality mode of PHP, and the buffer size allowed to be used by JIT.

Prior to PHP 8.4, the default INI configuration values for PHP were:

opcache.jit=tracing
opcache.jit_buffer_size=0

JIT is enabled by setting the opcache.jit_buffer_size INI value, which is not as intuitive because the opcache.jit toggle also accepted opcache.jit=disable value.

 opcache.jit=tracing
-opcache.jit_buffer_size=0
+opcache.jit_buffer_size=64M

In PHP 8.4, the default values for the two configuration options are changed as follows. JIT continues to be disabled by default in PHP 8.4. The only difference is that the default values for INI values have changed.

-opcache.jit=tracing
+opcache.jit=disable

-opcache.jit_buffer_size=0
+opcache.jit_buffer_size=64M

Note that even with the default value changes, JIT is disabled by default.

Backward Compatibility Impact

This is a default value change, but JIT continues to be disabled by default. Applications that do not modify the default opcache.jit* configuration values will not have any impact.

PHP applications that enabled JIT exclusively with opcache.jit_buffer_size configuration value will need to enable JIT with opcache.jit=tracing because the default value of opcache.jit has changed from tracing to disable in PHP 8.4.

; Enable JIT, and set buffer size to 128 MB.
+opcache.jit=tracing
opcache.jit_buffer_size=128M

JIT In Depth
A detailed guide on optimal JIT configuration, benchmarks, and how JIT works in detail.

Related Changes


RFC Discussion Implementation