Skip to main content

php-fmp : Permission denied when accessing to socket

Since last 5.5.12 update for php-fpm you might find you cannot run php webs on your host and you might find messages similar to this on your logs:

connect() to unix:/var/run/php5-fpm.sock failed (13: Permission denied) while connecting to upstream

Fixing bug #67060 they changed the default behaviour for FPM when creating its sockets. You probably used to have in you config file two lines like this:

user = www-data
group = www-data

While this created both the process and the socket file with that user and group, now it does it only for the process, and the socket file is created by default with root as an owner.

Now you have to add this, changing to the appropriate user if needed:

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

And restart your php-fpm process.

Thanks!