why is php-fpm running as nobody?

7,476

PHP-FPM does not execute the script as the owner of the script, but as the user configured in the matching pool config.

On my Debian system, the default pool www is defined in /etc/php5/fpm/pool.d/www.conf and contains:

; Unix user/group of processes
; Note: The user is mandatory. If the group is not set, the default user's group
;       will be used.
user = www-data
group = www-data

Yours will probably have user=nobody and group=nobody. You can create more pools and use them by assigning them in your Apache/NGINX/whatever configs.

Share:
7,476
zaxxon
Author by

zaxxon

Updated on September 18, 2022

Comments

  • zaxxon
    zaxxon almost 2 years

    I recently installed php-fpm on my server (CENTOS 6.5 x86_64 standard, WHM 11.44.1 (build 7)) following the instructions here: http://infoliser.com/how-to-configure-apache-2-2-with-php-fpm-using-whm-cpanel-and-easyapache/

    The server API, as revealed by phpinfo(), is now FPM/FastCGI.

    However, when I run a php script containing exec('id'), I get:

    uid=99(nobody) gid=99(nobody) groups=99(nobody)

    I got the impression that php-fpm would run as the uid of the owner of the php script, rather than as the owner of the http process (as in this case). This page http://php-fpm.org/ says fpm has the "Ability to start workers with different uid/gid/chroot/environment and different php.ini (replaces safe_mode)".

    What am I doing wrong?