标签 - php-fpm

php-fpm    2020-07-08 14:28:40    58    0    0

php fpm安装curl后,nginx出现connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied)的错误

 

这里选择直接apt-get安装,因为比起自己编译简单多了,不需要自己配置什么

#sudo apt-get install curl libcurl3 libcurl3-dev php5-curl

安装后重启nginx

#nginx -s reload

岂知出现错误,php全部不能访问,查看错误日志如下:

2014/07/24 23:59:46 [crit] 40455#0: *229072 connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream, client: 171.9

处理方式是:编辑/etc/php5/fpm/pool.d/www.conf文件,将以下的注释去掉:

listen.owner = www-data
listen.group = www-data
listen.mode = 0660

然后重启php5-fpm

sudo service php5-fpm restart

即可。参考文章:

 

After doing an upgrade on my Debian virtual server, which upgraded PHP and Nginx, I got a "502 Bad Gateway" error when browsing websites on that server. This post shows how to fix this problem, and the configuration option to prevent it occurring again on reboot. 

tl;dr

Edit /etc/php5/fpm/pool.d/www.conf and uncomment the following:
    listen.owner = www-data
    listen.group = www-data
    listen.mode = 0660

Then run:
    sudo servi