What Is the PHP JIT Compiler?
The Just-In-Time (JIT) compiler was introduced in PHP 8.0 as part of OPcache. It compiles PHP bytecode into native machine code at runtime, delivering significant performance gains for CPU-intensive workloads such as mathematical computations, image processing, and data transformations.
Prerequisites
- A Breeze running Ubuntu 22.04 or later with PHP 8.0+
- OPcache extension enabled
- Root or sudo access
Step 1: Verify OPcache Is Enabled
php -m | grep -i opcacheIf OPcache is not listed, install it:
sudo apt install php-opcacheStep 2: Configure JIT in php.ini
Open your PHP configuration file:
sudo nano /etc/php/8.3/fpm/conf.d/10-opcache.iniAdd or update the following directives:
opcache.enable=1
opcache.jit_buffer_size=128M
opcache.jit=1255Understanding JIT Modes
1255— Tracing JIT with optimizations (recommended for most workloads)1205— Tracing JIT without register allocation (lower memory)disable— Turns JIT off entirely
Step 3: Restart PHP-FPM
sudo systemctl restart php8.3-fpmStep 4: Verify JIT Is Active
Create a quick info page or use the CLI:
php -r "var_dump(opcache_get_status()['jit']);"You should see enabled => true and the buffer size you configured.
Performance Tips
- JIT benefits CPU-bound tasks most; typical web applications may see modest gains
- Monitor memory usage — increase
jit_buffer_sizeif the buffer fills up - Combine JIT with OPcache preloading for maximum throughput on your Breeze