ubuntu环境下启动php-fpm失败Job for php-fpm.service failed...

root@4fun:~# service php-fpm start
Job for php-fpm.service failed because the control process exited with error code. See "systemctl status php-fpm.service" and "journalctl -xe" for details.

查看原因:

root@4fun:~# systemctl status php-fpm.service
● php-fpm.service - LSB: starts php-fpm
   Loaded: loaded (/etc/init.d/php-fpm; bad; vendor preset: enabled)
  Drop-In: /etc/systemd/system/php-fpm.service.d
           └─override.conf
   Active: failed (Result: exit-code) since Thu 2018-05-17 17:14:02 CST; 5min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 27858 ExecStop=/etc/init.d/php-fpm stop (code=exited, status=0/SUCCESS)
  Process: 28308 ExecStart=/etc/init.d/php-fpm start (code=exited, status=1/FAILURE)

May 17 17:14:02 xcys systemd[1]: Starting LSB: starts php-fpm...
May 17 17:14:02 xcys php-fpm[28308]: Starting php-fpm [17-May-2018 17:14:02] WARNING: Nothing matches the include pattern '/usr/local/php/etc/php-fpm.d/*.conf' from /usr
May 17 17:14:02 xcys php-fpm[28308]: [17-May-2018 17:14:02] ERROR: No pool defined. at least one pool section must be specified in config file
May 17 17:14:02 xcys php-fpm[28308]: [17-May-2018 17:14:02] ERROR: failed to post process the configuration
May 17 17:14:02 xcys php-fpm[28308]: [17-May-2018 17:14:02] ERROR: FPM initialization failed
May 17 17:14:02 xcys php-fpm[28308]:  failed
May 17 17:14:02 xcys systemd[1]: php-fpm.service: Control process exited, code=exited status=1
May 17 17:14:02 xcys systemd[1]: Failed to start LSB: starts php-fpm.
May 17 17:14:02 xcys systemd[1]: php-fpm.service: Unit entered failed state.
May 17 17:14:02 xcys systemd[1]: php-fpm.service: Failed with result 'exit-code'.

原因是在/usr/local/php/etc/php-fpm.d目录下缺少对应的.conf配置文件

安装php-fpm时候系统会自动生成一个默认的配置文件,进入php-fpm.d文件夹可以看到:

root@4fun:~# cat /usr/local/php/etc/php-fpm.d/www.conf.default 
.bash_history     .cache/           .my.cnf           .profile          .vim/             lnmp-install.log  
.bashrc           .composer/        .pearrc           .ssh/             .viminfo          lnmp1.4/          
root@4fun:~# cat /usr/local/php/etc/php-fpm.d/www.conf.default 
.bash_history     .cache/           .my.cnf           .profile          .vim/             lnmp-install.log  
.bashrc           .composer/        .pearrc           .ssh/             .viminfo          lnmp1.4/          
root@4fun:~# cat /usr/local/php/etc/php-fpm.d/www.conf.default 
.bash_history     .cache/           .my.cnf           .profile          .vim/             lnmp-install.log  
.bashrc           .composer/        .pearrc           .ssh/             .viminfo          lnmp1.4/          
root@4fun:~# cd /usr/local/php/etc/php-fpm.d/
root@4fun:/usr/local/php/etc/php-fpm.d# ls
www.conf.default

将该文件复制一份重命名问*.conf名称,重新启动php-fpm即可

root@4fun:/usr/local/php/etc/php-fpm.d# cp www.conf.default www.conf
root@4fun:/usr/local/php/etc/php-fpm.d# ls
www.conf  www.conf.default

root@4fun:/usr/local/php/etc/php-fpm.d# service php-fpm start

你可能感兴趣的:(Linux工具,Linux段位记)