简体   繁体   中英

FCGI and upload_tmp_dir PHP directive are not working correctly

I run PHP as FCGI ! I'm setting upload_tmp_dir option as value /home/domain.com/tmp . When executed phpinfo() for double-check it's confirmed that the settings above are correct.

Nevertheless, when actual upload in happening, the uploading file is temporarily going to /tmp directory with permissions apache:apache and when the upload is fully finished only then the uploaded file is being moved to the destination directory, which was set in upload_tmp_dir . After file is moved it has proper permissions which are domainowner:domainowner .

What's happening with FCGI as described above is absolutely wrong and different from what mod_php or CGI are doing! mod_php and CGI just start uploading a file directly to the upload_tmp_dir and then just rename the file after upload is finished.

I have few considerable concerns about this as follows:

Imagine, what happens if 20 people, finish uploading a file that is around 2GB, right at the same time? Uploaded files will have to be moved to the home directory from /tmp , creating a lot of useless load on file system! Thus, I thought that moving is much more resourceful rather than just renaming a file in the same directory?! Besides /tmp is mounted as ext3 and home as ext4 and what is even worse that /tmp partition is 16GB of space, which is total disaster from what I have imagined above?

Question:

How to force FCGI to use upload_tmp_dir directive the same way as CGI or mod_php ? I haven't found a documented way to change the temp directory it uses.

Please help!?

This issue was discussed at bugs.php.net . The possible solution is that you need to set read attributes on any parent directory to where your tmp folder is, to make it work. It could be a security risk.

I would recommend creating a tmp in /home/tmp setting chmod 777 to both home and tmp

This thread suggests that it may be due to a security level setting. If 'medium' then FCGI defaults to the system default.

Not sure what setting it is referencing though since it is referring to a desktop installation. I will do some digging.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM