Apologies in advance if my terminology is not on par.

So I've just setup my work dev machine successfully on Fedora Workstation with Nginx and multiple PHP versions (using Remi Collet's Software Collection). I have PHP-5.6.30 listening on Port 9056 and PHP-7.0.19 listening on Port 9070. This works perfectly.

This morning I decided to try running both PHP instances using FPM Sockets, which initially worked until I restarted the PHP-FPM service (this resulted in a 502 Bad gateway in the browser, and (13) Permission Denied error in the nginx error.log).

So using PHP5.6 as an example ... when I first started the php56-php-fpm service which generated /opt/remi/php56/root/var/run/php-fpm/www.sock, I changed the generated www.sock file's user and group to nginx:nginx. After restarting php56-php-fpm I learned that www.sock was being reset to root:root. Now granted I won't be restarting FPM constantly, but there must be a way to set some defaults on the .sock file?? My fpm conf files looks like this:

I realise that this sounds like a pain to get working correctly, considering that I am just doing this for local development, and that I did have this all working correctly using ports 9056 & 9070. But I've read that there are some speed benefits using sockets versus TCP, and anything that would speed up my local dev environment is worth making the effort for.

So my questions:

  1. What in my config is incorrect that is causing www.sock to be reset to root:root after restarting the respective FPM service?
  2. Is it really worth moving away from ports in favour of sockets?
  3. [slightly off-topic]: using Remi Collet's software collection, I see that the 2 PHP packages install to different locations: /opt/remi/php56 and /etc/opt/remi/php70 ... for the purpose of consistency, should I consider moving either one of these into a more common location?

Thank you

2 Answers 2


A few things to check...

1) By default under CentOS PHP doesn't include the configuration files in the php-fpm.d directory, ensure you have include=/opt/remi/php56/root/etc/php-fpm.d/*.conf in the php-fpm.conf file.

2) You need to ensure you set the socket ownership in the php-fpm pool configuration, for example:

listen       = /opt/remi/php56/root/var/run/php-fpm/$pool.sock
listen.owner = someuser
listen.group = somegroup
listen.mode  = 0600

In my own case on remi's php80-php-fpm, I had to change listen.acl_users variable in ../php-fpm.d/www.conf to my webserver's user. For example:

;comment: replace mywebserveruser with your own user 
listen.acl_users = mywebserveruser
  • @ckujau Comment wouldn't have been sufficient for an elaborate explanation. Besides a lot of people hardly read comments and sometimes people post this solutions for their future selves. It also took me sometime to discover the problem to my own unique case. Hence, I feel it would be useful to others in the future.
    – Dev
    Commented Aug 2, 2023 at 11:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .