nginx php-fpm uploaded files have nginx ownership after executing move uploaded file

Posted by Vangel on Server Fault See other posts from Server Fault or by Vangel
Published on 2012-07-05T21:11:31Z Indexed on 2012/07/05 21:17 UTC
Read the original article Hit count: 363

Filed under:
|
|
|

I have a problem with php 5.3.6 using PHP-FPM and file uploads.

My Nginx runs as user nginx PHP-FPM uses pools configured for each vhost. For example a user: test group : test runs one pool.

When the php file uploads to temp file it is owned by user test. After move_uploaded_file is executed by php script it is owned by nginx :/. The reason for this could be the fact that the original upload file script does an exec('/usr/bin/php do_uploadedfiles.php') which does the actual moving.

I do not know if the change in ownership to web server is the correct behaviour. Is there a way in PHP to change the ownership back to the user I want? Maybe make exec "run as"?

© Server Fault or respective owner

Related posts about nginx

Related posts about php-fpm