用過 Nginx 的兄弟都知道,修改 Nginx 配置文件以後,可使用php
nginx -t
來檢測配置文件是否有語法錯誤。nginx
今天配置 opcache 的時候,發現 php-fpm 也能夠檢測 php-fpm.conf , php.ini 等配置文件的正確與否。php-fpm
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 服務了。spa
這個錯誤的緣由是,我把 interned_strings_buffer 的大小設置成了等於 memory_consumption,而 interned_strings_buffer 的配置理論上應該比 memory_consumption 小。code
[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