php-fpm 重启失败怎么办

2023-02-09

php-fpm重启失败的解决办法:1、查看一下对应的nginx的配置文件为“root@example:/# vim /etc/nginx/sites-enabled/example.conf”;2、通过“service php7.0-fpm restart”命令重启即可。

本教程操作环境:ubuntu 16.04系统、php7.0版、DELL G3电脑

php-fpm 重启失败怎么办?

在 Ubuntu 服务器上重启 php-fpm失败

在 Ubuntu 服务器上修改过 PHP 配置文件后,想重启 php-fpm ,结果出现了这样的问题:

root@example:/# service php-fpm restart
php-fpm: unrecognized service

查看一下对应服务:

root@example:/# service --status-all | grep -i fpm
[ ? ]  aliyun-rdate
[ ? ]  console-setup
[ ? ]  dns-clean
[ ? ]  irqbalance
[ ? ]  killprocs
[ ? ]  kmod
[ ? ]  mysql
[ ? ]  networking
[ ? ]  ondemand
[ + ]  php5-fpm
[ + ]  php7.0-fpm
[ ? ]  pppd-dns
[ ? ]  rc.local
[ ? ]  sendsigs
[ ? ]  umountfs
[ ? ]  umountnfs.sh
[ ? ]  umountroot

原来之前的人给服务器装了两个版本的 php-fpm ,而且都不名字都不叫 php-fpm ,所以我光打个 php-fpm 系统是不认识的。

查看一下对应的 nginx 的配置文件:

root@example:/# vim /etc/nginx/sites-enabled/example.conf
1 server {
2         listen 80;
3         server_name abc.example.com;
4         root /mnt/www/example;
5         index index.php index.html;
6
7         location ~ \.php$ {
8                 fastcgi_pass unix:/run/php/php7.0-fpm.sock;
9                 fastcgi_index index.php;
10                 include fastcgi_params;
11         }
12
13         location / {
14                 if (!-e $request_filename) {
15                         rewrite ^(.*)$ /index.php?s=$1 last;
16                         break;
17                 }
18         }
19
20 }

它监听的是 php7.0-fpm , 所以只需重启这个就行:

root@example:/etc/nginx/sites-enabled# service php7.0-fpm restart
php7.0-fpm stop/waiting
php7.0-fpm start/running, process 2807
root@example:/etc/nginx/sites-enabled#

推荐学习:《PHP视频教程》

以上就是php-fpm 重启失败怎么办的详细内容,更多请关注北冥有鱼其它相关文章!

本文转载自【PHP中文网】,希望能给您带来帮助,苟日新、日日新、又日新,生命不息,学习不止。

《php-fpm 重启失败怎么办.doc》

下载本文的Word格式文档,以方便收藏与打印。