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


1

我怎样才能弄清楚是什么阻碍了我起步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状态结果

$ 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

因此,请从php7.0-fpm.service和journalctl提供详细信息。但是,“另一个FPM实例似乎已经在监听”是失败的原因
Ramhound

@Ramhound我用详细信息更新了问题,两者似乎都说另一个进程已经在监听。我不知道是什么?
veilig

如果您完全确定它没有在运行,则可以删除该/run/php/php7.0-fpm.sock文件,然后重试。可能另一个实例挂起或未完全关闭且未删除袜子文件。
NKN

@nKn,我认为它没有运行。我尝试重新启动服务器,并得到相同的结果。它是一个登台服务器,所以无论我要杀了什么还是重启都没关系。停机时间并不关键
揭露2017年

2
您是否尝试过在尝试重新启动之前删除袜子文件?
NKN

Answers:


0

对我来说,我只需要删除sock文件,然后php-fpm将再次启动。

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

或者在我的配置上是:

$ rm /var/run/php/php7.0-fpm.sock
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.