3 回答

TA貢獻1815條經驗 獲得超13個贊
您可以通過調用直接查詢 opcache 設置opcache_get_status()
:
opcache_get_status()["jit"]["enabled"];
或在以下位置執行查找php.ini:
ini_get("opcache.jit")
這是一個整數(以字符串形式返回),其中最后一位數字表示 JIT 的狀態:
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
來源: https: //wiki.php.net/rfc/jit#phpini_defaults

TA貢獻1824條經驗 獲得超6個贊
opcache_get_status()當 JIT 被禁用時將不起作用并會拋出致命錯誤。
echo (function_exists('opcache_get_status')
&& opcache_get_status()['jit']['enabled']) ? 'JIT enabled' : 'JIT disabled';
我們必須在文件中對 JIT 進行以下設置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貢獻1869條經驗 獲得超4個贊
php -i | grep "opcache"
checking:
opcache.enable => On => On
opcache.enable_cli => On => On
opcache.jit => tracing => tracing
- 3 回答
- 0 關注
- 300 瀏覽
添加回答
舉報