PHP-FPM runs PHP scripts as root
        Posted  
        
            by 
                fwalch
            
        on Server Fault
        
        See other posts from Server Fault
        
            or by fwalch
        
        
        
        Published on 2011-04-26T21:41:58Z
        Indexed on 
            2014/06/12
            15:28 UTC
        
        
        Read the original article
        Hit count: 310
        
I have a web server setup using nginx and PHP-FPM listening on a Unix socket. In my php-fpm.conf, I have specified
user = www
group = www
When I run ps aux, I can see that the php-fpm worker processes run as www; the php-fpm master process runs as root.
However, I noticed that PHP scripts are executed as root; at least that's the output of
echo get_current_user();
What can I do to run scripts as the www user? How can this even happen if the worker processes run as www?
© Server Fault or respective owner