Header Ads

How to setup JIT php 8.1 on ubuntu 20.04

How to setup JIT php 8.1 on ubuntu 20.04


PHP JIT

1, Disable Xdebug

sudo mv /etc/php/8.1/mods-available/xdebug.ini /etc/php/8.1/mods-available/xdebug.ini.bak

2, Install Opcache

sudo apt-update install php-opcache

// Let install specify php8.1
sudo apt-update install php8.1-opcache

3, Setting turn on JIT

sudo vim /etc/php/8.1/mods-available/opcache.ini

; configuration for php opcache module
; priority=10
zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1
opcache.jit_buffer_size=128M
opcache.jit=tracing

4, Test JIT with script

<?php

function isJitEnabled(): bool
{
    if (!function_exists('opcache_get_status')) {
        return false;
    }
 
    return !empty(opcache_get_status()['jit']['enabled']);
}
 
echo isJitEnabled() ? 'Enabled' : 'Disabled';

5, Good for you !!

No comments