Reputation: 267
I am trying to upload a file on my Apache server on Fedora 25 (32 bit) using PHP 7.0.15.
I am getting an UPLOAD_ERR_NO_TMP_DIR error, even though I have set appropriate (and even more than I should have, but I am working locally at the moment) permissions for the upload directories and i have changed the owner of the directory to apache.
I am trying to upload a .docx file 6kB large, my upload_tmp_dir
in php.ini
is set to /home/temporary
.
ls -l
returns the following code:
drwxrwxrwx. 2 apache root 4096 Feb 11 20:14 temporary
sys_get_tmp_dir()
returns the correct path: /home/temporary
But I still get error 6
debug outputArray
(
[userfile] => Array
(
[name] => rus.docx
[type] =>
[tmp_name] =>
[error] => 6
[size] => 0
)
)
What can cause this problem?
Upvotes: 1
Views: 6140
Reputation: 450
Put the temporary directory under /var/www
or /var/www/html
.
Apart from this action you also need to grant Apache
the rewrite
permissions with semanage.
Upvotes: 2
Reputation: 126
You need to check few things in your php.ini
. Make sure you are hitting right php.ini
:
upload_tmp_dir
: This is the directory where PHP stores temporary files while uploading.open_basedir
: Limits PHP read/write rights operation to a specified path and its subdirectories. Make sure upload_tmp_dir is inside this path!post_max_size
: Make it bigger to accommodate your uploaded size.upload_max_filesize
: Allowed limit of file size.If you want to tweak with tmp directory setting try editing /etc/profile
or /etc/environment
of your choice (for current session only or for all time) and above checks works with it.
Upvotes: 3