1. 程式人生 > >php-fpm 配置檔案檢測

php-fpm 配置檔案檢測

用過 Nginx 的兄弟都知道,修改 Nginx 配置檔案之後,可以使用

nginx -t 

來檢測配置檔案是否有語法錯誤。

今天配置 opcache 的時候,發現 php-fpm 也可以檢測 php-fpm.conf , php.ini 等配置檔案的正確與否。

sudo php-fpm7.0 -t
[28-Dec-2018 08:57:02] NOTICE: configuration file /etc/php/7.0/fpm/php-fpm.conf test is successful

sudo php-fpm7.0 -t
Fri Dec 28 09:03:22 2018 (3365): Fatal Error Zend OPcache cannot allocate buffer for interned strings

沒有問題之後,就可以重啟 fpm 服務了。

Fatal Error Zend OPcache cannot allocate buffer for interned strings

這個錯誤的原因是,我把 interned_strings_buffer 的大小設定成了等於 memory_consumption,而 interned_strings_buffer 的配置理論上應該比 memory_consumption 小。

[opcache]
opcache.enable=1
opcache.memory_consumption=64
opcache.interned_strings_buffer=4    // 原來為 64
opcache.max_accelerated_files=2000
opcache.validate_timestamps=0
opcache.save_comments=1
opcache.fast_shutdown=1