我遇到了与Ubuntu 14.10上的php5-fpm有关的类似问题。我已经为其中一个虚拟主机配置了php5-fpm,当尝试浏览网站时,我得到了503服务不可用。每次我都试过
root@testupgrade:~# service php5-fpm restart
stop: Unknown instance:
php5-fpm start/running, process 2775
我在系统日志中得到了以下内容:
Dec 7 14:08:53 testupgrade kernel: [ 230.711612] init: php5-fpm main process (2775) terminated with status 78
Dec 7 14:08:53 testupgrade kernel: [ 230.711639] init: php5-fpm main process ended, respawning
Dec 7 14:08:53 testupgrade kernel: [ 230.866617] init: php5-fpm main process (2783) terminated with status 78
Dec 7 14:08:53 testupgrade kernel: [ 230.866643] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.027522] init: php5-fpm main process (2791) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.027548] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.137792] init: php5-fpm main process (2799) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.137807] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.221146] init: php5-fpm main process (2807) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.221161] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.301859] init: php5-fpm main process (2815) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.301874] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.381635] init: php5-fpm main process (2823) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.381649] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.469211] init: php5-fpm main process (2831) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.469225] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.548950] init: php5-fpm main process (2839) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.548964] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.628781] init: php5-fpm main process (2847) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.628795] init: php5-fpm main process ended, respawning
Dec 7 14:08:54 testupgrade kernel: [ 231.711933] init: php5-fpm main process (2855) terminated with status 78
Dec 7 14:08:54 testupgrade kernel: [ 231.711947] init: php5-fpm respawning too fast, stopped
然后,我尝试的是检查我对此虚拟主机池的php5-fpm配置是否实际正常工作。它被配置为在 TCP 端口上列出,在 /etc/php5/fpm/pool.d/www.conf 中具有以下配置,我已正确指示池按如下方式列出:
listen = 127.0.0.1:9000
我尝试使用service命令重新启动几次,由于它不起作用,我决定检查启动脚本。我编辑了/etc/init/php5-fpm.conf,我注意到我已经有最新的错误修复版本的“重新加载信号USR2”行。然后我注意到下面这一行:
pre-start exec /usr/lib/php5/php5-fpm-checkconf
我检查了 /usr/lib/php5/php5-fpm-checkconf 脚本,并注意到附加到$errors变量的语法检查:
/usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/php-fpm.conf
我在 shell 中执行了它,并注意到以下内容:
root@testupgrade:~# /usr/sbin/php5-fpm --fpm-config /etc/php5/fpm/php-fpm.conf
[07-Dec-2014 13:46:14] ERROR: [pool www] 'slowlog' must be specified for use with 'request_slowlog_timeout'
[07-Dec-2014 13:46:14] ERROR: failed to post process the configuration
[07-Dec-2014 13:46:14] ERROR: FPM initialization failed
这意味着我已经触摸了我的php-fpm.conf并将其搞砸了,但是错误无处可寻,我没有迹象表明这是php5-fpm服务启动失败的原因。我修复了/etc/php5/fpm/pool.d/www.conf文件中的语法,然后尝试使用服务命令再次重新启动。服务在所需的端口 9000 上启动并打开了 tcp 侦听器。虚拟主机也开始工作。因此,请务必使用上述命令检查php-fpm语法和配置,以避免服务未启动的问题。