3 回答

TA貢獻(xiàn)1815條經(jīng)驗(yàn) 獲得超13個(gè)贊
您可以通過(guò)調(diào)用直接查詢 opcache 設(shè)置opcache_get_status()
:
opcache_get_status()["jit"]["enabled"];
或在以下位置執(zhí)行查找php.ini:
ini_get("opcache.jit")
這是一個(gè)整數(shù)(以字符串形式返回),其中最后一位數(shù)字表示 JIT 的狀態(tài):
0 - don't JIT
1 - minimal JIT (call standard VM handlers)
2 - selective VM handler inlining
3 - optimized JIT based on static type inference of individual function
4 - optimized JIT based on static type inference and call tree
5 - optimized JIT based on static type inference and inner procedure analyses
來(lái)源: https: //wiki.php.net/rfc/jit#phpini_defaults

TA貢獻(xiàn)1824條經(jīng)驗(yàn) 獲得超6個(gè)贊
opcache_get_status()當(dāng) JIT 被禁用時(shí)將不起作用并會(huì)拋出致命錯(cuò)誤。
echo (function_exists('opcache_get_status')
&& opcache_get_status()['jit']['enabled']) ? 'JIT enabled' : 'JIT disabled';
我們必須在文件中對(duì) JIT 進(jìn)行以下設(shè)置php.ini。
zend_extension=opcache.so
opcache.enable=1
opcache.enable_cli=1 //optional, for CLI interpreter
opcache.jit_buffer_size=32M //default is 0, with value 0 JIT doesn't work
opcache.jit=1235 //optional, default is "tracing" which is equal to 1254

TA貢獻(xiàn)1869條經(jīng)驗(yàn) 獲得超4個(gè)贊
php -i | grep "opcache"
checking:
opcache.enable => On => On
opcache.enable_cli => On => On
opcache.jit => tracing => tracing
- 3 回答
- 0 關(guān)注
- 315 瀏覽
添加回答
舉報(bào)