Enable the PHP JIT compiler
ServerPilot does not enable the JIT by default. This is because the design of the JIT as well as current benchmarks show that it may hurt web application performance rather than improve it.
Unless you’re dealing with a long-running CPU-intensive PHP program that is not a web application, enabling the JIT for performance improvements will probably not be a good use of your time.
The steps below enable the JIT for PHP-FPM, which runs your apps’ web requests. To also enable it for command-line programs, see Enable the JIT for the PHP CLI.
To enable the PHP JIT compiler,
SSH into your server as root and edit the following file.
/etc/php8.6-sp/conf.d/opcache.ini/etc/php8.5-sp/conf.d/opcache.ini/etc/php8.4-sp/conf.d/opcache.ini/etc/php8.3-sp/conf.d/opcache.ini/etc/php8.2-sp/conf.d/opcache.ini/etc/php8.1-sp/conf.d/opcache.ini/etc/php8.0-sp/conf.d/opcache.iniAdd the following lines to the end of the file.
opcache.jit=tracingopcache.jit_buffer_size=100MFinally, restart PHP.
sudo service php8.6-fpm-sp restartsudo service php8.5-fpm-sp restartsudo service php8.4-fpm-sp restartsudo service php8.3-fpm-sp restartsudo service php8.2-fpm-sp restartsudo service php8.1-fpm-sp restartsudo service php8.0-fpm-sp restartTo verify the JIT was enabled, create a page that calls the phpinfo() function
and request the page from your browser, as described in
View settings with phpinfo().
In the Zend OPcache section, verify the JIT row shows On,
opcache.jit shows tracing, and opcache.jit_buffer_size shows 100M.
Enable the JIT for the PHP CLI
OPcache, and so the JIT, is off by default for command-line PHP programs. To enable the JIT for the CLI, also add the following line to the same file:
opcache.enable_cli=1To verify the JIT is enabled for the CLI, run the following command. Use the versioned command for the PHP version you changed.
php8.6-sp -i | grep -iE '^(opcode caching|jit) 'Check both lines: Opcode Caching must show Up and Running, and JIT must show On.
If Opcode Caching shows Disabled, the JIT is not running for the CLI,
even if the JIT line shows On.