php5-fpm socket permission denied.

by

in

After updating the system, one error occured, despite that everything worked before.

2014/10/19 23:01:34 [crit] 27407#0: *11 connect() to unix:/tmp/php.sock failed (13: Permission denied) while connecting to upstream, client: 78.58.224.49, server: domain.tld, request: "GET / HTTP/1.1", upstream: "fastcgi://unix:/tmp/php.sock:", host: "domain.tld"

The reason of it is that despite the defined user:

user = www-data
group = www-data

The php startup script still created the socket with the owner of root, and nginx was not able to reach it:

# ls -lah /tmp/php.sock
srw-rw---- 1 root root 0 Oct 19 23:02 /tmp/php.sock

The fix is to add the socket owner with these lines:

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

And that’s it. Site is up and running again.

# ls -lah /tmp/php.sock 
srw-rw---- 1 www-data www-data 0 Oct 19 23:11 /tmp/php.sock

apache_debian_php_fpm_apc


Comments

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.