With the realease of PHP 8, Just-In-Time compilation (JIT) has been supported. However JIT is not enabled by default. So this post will talk about how to enable JIT with PHP 8.2.
After install PHP, we have the version of 8.2 like this:
Next, install the opcache
extension by:
1 | sudo apt update -y |
Then, to enable JIT, i was expecting that the configuration of JIT was also in the php.ini
. I change it as below:
1 | $ sudo vim /etc/php/8.2/fpm/php.ini |
Restarted the PHP-FPM and checked the phpinfo()
:
It was stranged that the JIT was not enabled as expected. It seems that the configuration did not worked.
There are lots of posts talking about how to enable the JIT in PHP, but quite a few blogs that introduce while file can be configured for the JIT. After read the JUNDAT95’s post, I found that JIT should configured in a single file which was called opcache.ini
. In my server (Ubuntu, PHP 8.2), the file was located in /etc/php/8.2/mods-available/opcache.ini
, add the commands in this file:
1 | // /etc/php/8.2/mods-available/opcache.ini |
Restart FPM and echo the phpinfo()
again, it showed that JIT was enabled successfully.