7

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?

1
  • php-fpm has its own configuration file
    – ADM
    Aug 2, 2014 at 9:20

1 Answer 1

8

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.