PHP can't upload to /tmp with php 7.2+

lonea

Verified User
Joined
Jan 3, 2009
Messages
45
1) upload_tmp_dir is set to /tmp already
2) open_basedir is enabled for the account
3) SELinux is not enabled

Used a test upload script and these are the result.

upload_tmp_dir is set to: /tmp
/tmp is a valid directory
/tmp is writeable
PHP could not create a file in /tmp

Code:
ls -alZ /tmp | less
drwxrwxrwt. root     root     system_u:object_r:tmp_t:s0       .
dr-xr-xr-x. root     root     system_u:object_r:root_t:s0      ..

The error code is 6

The uploading worked in php5, but if changed to php7.2+ uploading doesn't work. What am I missing
 
Last edited:
Seems like it's related to the PHP-FPM setting not being able to access /tmp

I added the following to the global custom to it's user's own tmp file instead and it started to work.

Code:
php_admin_value[upload_tmp_dir] = /home/$pool/tmp

Edit: I guess it's a centos 7 setting.

The fix is here

 
Back
Top