php-fpm开启报错-ERROR: An another FPM instance seems to already listen on /tmp/php-cgi.sock详解

重新启动php-fpm过程中遇到一个报错。

 An another FPM instance seems to already listen on /tmp/php-cgi.sock
# netstat -ant | grep 9000  //查看启动进程,发现没启动成功

我们去查看一下php-fpm.conf里面的配置:

# vim  /usr/local/php/etc/php-fpm.conf  
[www] 
listen = /tmp/php-cgi.sock   //注意 
listen.backlog = -1 
listen.allowed_clients = 127.0.0.1 
listen.owner = www 
listen.group = www

此时我们需要根据配置文件的listen地址做对应的修改:

# vim /usr/local/nginx/conf/nginx.conf
location ~ [^/].php(/|$) { 
       fastcgi_pass unix:/tmp/php-cgi.sock;    //把127.0.0.1:9000改为此行 
       fastcgi_index index.php; 
       fastcgi_param SCRIPT_FILENAME     $document_root$fastcgi_script_name; 
       include fastcgi_params; 
} 
location / { 
      root   html; 
      index index.php index.html index.htm; 
}

修改完平滑重启nginx (nginx -s reload ),然后启动php-fpm

原文地址:https://www.cnblogs.com/zoutong/p/14010962.html