I want to execute php-fpm with a different user in my Ubuntu workstation, so I changed the /etc/php5/fpm/pool.d file according to some tutorials I found:
user = myuser
group = myuser
But when I try to restart php-fpm service, it crashes because my new user doesn't have permissions to create the pid and sock files under /var/run what totally makes sense since /var/run has root only permissions. But www-data was able to write under that folder and it didn't have any specials permissions as well, so I guess I must be missing some steps.
Do you know how to change the user of php-fpm and be sure it will be able to create the pid and sock files?
Obs: If I need to change the init script, I must say I'm not sure how to do it and any help would be appreciated.
php5-fpm
should actually be starting as root and dropping its privileges once it's set up and running. This is fairly common amongst webservers. This should allow it to write to a root-owned space and chown its own files.I believe that is exactly how my installation works.
The question then becomes: why isn't yours?
Have you altered the Upstart script that ships with it to
chuid
? That would break it. Here's my/etc/init/php5-fpm.conf
for comparison: