查找阻止 php7.0-fpm 启动的原因

查找阻止 php7.0-fpm 启动的原因

我如何才能弄清楚是什么阻止了我开始php7.0-fpm。似乎没有任何东西可以显示是什么阻止了它开始。

$ sudo service php7.0-fpm status
● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Fri 2017-08-11 16:52:04 EDT; 20h ago
 Main PID: 4171 (code=exited, status=78)

Aug 11 16:52:04 foo.com systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Aug 11 16:52:04 foo.com php-fpm7.0[4171]: [11-Aug-2017 16:52:04] ERROR: An another FPM instance seems to already listen on /run/php/php7.0-fpm.sock
Aug 11 16:52:04 foo.com php-fpm7.0[4171]: [11-Aug-2017 16:52:04] ERROR: FPM initialization failed
Aug 11 16:52:04 foo.com systemd[1]: php7.0-fpm.service: Main process exited, code=exited, status=78/n/a
Aug 11 16:52:04 foo.com systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
Aug 11 16:52:04 foo.com systemd[1]: php7.0-fpm.service: Unit entered failed state.
Aug 11 16:52:04 foo.com systemd[1]: php7.0-fpm.service: Failed with result 'exit-code'.

尝试查找是否有任何进程绑定到套接字,但没有结果

$ ps aux | grep fpm
me  19222  0.0  0.0  12944   984 pts/0    S+   13:56   0:00 grep --color=auto fpm

$ ps aux | grep php
me  19230  0.0  0.0  12944   976 pts/0    S+   13:56   0:00 grep --color=auto php

我无法启动服务

$ sudo service php7.0-fpm start
Job for php7.0-fpm.service failed because the control process exited with error code. See "systemctl status php7.0-fpm.service" and "journalctl -xe" for details.

journalctl 详细信息

$ journalctl -xe -n 20
Aug 12 14:26:48 foo.com sudo[27777]:  me : TTY=pts/0 ; PWD=/etc/apache2/sites-available ; USER=root ; COMMAND=/usr/sbin/service php7.0-fpm start
Aug 12 14:26:48 foo.com sudo[27777]: pam_unix(sudo:session): session opened for user root by me(uid=0)
Aug 12 14:26:48 foo.com systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
-- Subject: Unit php7.0-fpm.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit php7.0-fpm.service has begun starting up.
Aug 12 14:26:48 foo.com php-fpm7.0[27818]: [12-Aug-2017 14:26:48] ERROR: An another FPM instance seems to already listen on /run/php/php7.0-fpm.sock
Aug 12 14:26:48 foo.com php-fpm7.0[27818]: [12-Aug-2017 14:26:48] ERROR: FPM initialization failed
Aug 12 14:26:48 foo.com systemd[1]: php7.0-fpm.service: Main process exited, code=exited, status=78/n/a
Aug 12 14:26:48 foo.com sudo[27777]: pam_unix(sudo:session): session closed for user root
Aug 12 14:26:48 foo.com systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
-- Subject: Unit php7.0-fpm.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit php7.0-fpm.service has failed.
--
-- The result is failed.
Aug 12 14:26:48 foo.com systemd[1]: php7.0-fpm.service: Unit entered failed state.
Aug 12 14:26:48 foo.com systemd[1]: php7.0-fpm.service: Failed with result 'exit-code'.

systemctl status 结果

$ systemctl status php7.0-fpm.service
● php7.0-fpm.service - The PHP 7.0 FastCGI Process Manager
   Loaded: loaded (/lib/systemd/system/php7.0-fpm.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2017-08-12 14:29:46 EDT; 4s ago
  Process: 28363 ExecStart=/usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf (code=exited, status=78)
  Process: 28354 ExecStartPre=/usr/lib/php/php7.0-fpm-checkconf (code=exited, status=0/SUCCESS)
 Main PID: 28363 (code=exited, status=78)

Aug 12 14:29:46 foo.com systemd[1]: Starting The PHP 7.0 FastCGI Process Manager...
Aug 12 14:29:46 foo.com php-fpm7.0[28363]: [12-Aug-2017 14:29:46] ERROR: An another FPM instance seems to already listen on /run/php/php7.0-fpm.sock
Aug 12 14:29:46 foo.com php-fpm7.0[28363]: [12-Aug-2017 14:29:46] ERROR: FPM initialization failed
Aug 12 14:29:46 foo.com systemd[1]: php7.0-fpm.service: Main process exited, code=exited, status=78/n/a
Aug 12 14:29:46 foo.com systemd[1]: Failed to start The PHP 7.0 FastCGI Process Manager.
Aug 12 14:29:46 foo.com systemd[1]: php7.0-fpm.service: Unit entered failed state.
Aug 12 14:29:46 foo.com systemd[1]: php7.0-fpm.service: Failed with result 'exit-code'.

调试命令

$ sudo /usr/sbin/php-fpm7.0 --nodaemonize --fpm-config /etc/php/7.0/fpm/php-fpm.conf
[12-Aug-2017 15:00:23] ERROR: An another FPM instance seems to already listen on /run/php/php7.0-fpm.sock
[12-Aug-2017 15:00:23] ERROR: FPM initialization failed

答案1

对我来说,我只需要删除 sock 文件,然后 php-fpm 就会重新启动。

rm /run/php/php7.0-fpm.sock

或者在我的配置上它是:

rm /var/run/php/php7.0-fpm.sock

相关内容