一,测试是否开启jit?
[liuhongdi@img ~]$ more jit.php<?phpvar_dump(opcache_get_status()['jit']);?>
报错:
[liuhongdi@img ~]$ /usr/local/soft/php8.2.5/bin/php jit.php PHP Fatal error: Uncaught Error: Call to undefined function opcache_get_status() in /home/liuhongdi/jit.php:2 Stack trace:#0 {main} thrown in /home/liuhongdi/jit.php on line 2
二,配置jit
[root@img etc]# vi php.ini
1,编辑内容:
在[opcache]一栏下增加四行
opcache.enable=1opcache.enable_cli=1opcache.jit_buffer_size=128Mopcache.jit=1255
2,Dynamic Extensions一栏下面:
把zend_extension=opcache一行取消注释
如下:
;zend_extension=opcachezend_extension=opcache
三,测试效果:
[root@img etc]# /usr/local/soft/php8.2.5/bin/php /home/liuhongdi/jit.php array(7) { ["enabled"]=> bool(true) ["on"]=> bool(true) ["kind"]=> int(5) ["opt_level"]=> int(5) ["opt_flags"]=> int(6) ["buffer_size"]=> int(134217712) ["buffer_free"]=> int(134215280) }
如enabled和on两项的值为true,则表示jit已开启
四,查看php版本:
[liuhongdi@img ~]$ /usr/local/soft/php8.2.5/bin/php -v PHP 8.2.5 (cli) (built: May 10 2023 14:51:39) (NTS) Copyright (c) The PHP GroupZend Engine v4.2.5, Copyright (c) Zend Technologies with Zend OPcache v8.2.5, Copyright (c), by Zend Technologies
发表评论:
◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。