I am hosting multiple domains on my Apache Web Server on Ubuntu 18.04 but I cannot set the tmp upload directory for PHP.
I tried putting this in my .htaccess for one of the domains, however nothing was stored when I tested.
php_value upload_tmp_dir /var/www/example.com/tmp/
My permissions for the /var/www/example.com/tmp/ folder are set at Chmod 775
Is there a working way to set this in .htaccess or in the domain’s .conf file?
3
Answers
UPDATE:
Try adding this in your vhost configration file:
It temporarily turns off
open_basedir
, if that works, means you need to change youropen_basedir
path.From PHP manual
So make sure the directory is writable and has sufficient permission, create it of not exists.
I’ve made something like that for my vhosts on my local machine. Note that everything is defined in my vhost because you can’t change
upload_tmp_dir
andsys_temp_dir
in runtime.How to confirm that everything works:
Create simple file:
Upload script: create file named upload.php
That can be done by adding the following line in your
php.ini
file:Example :
Alternatively, you can set for just one domain, by adding the following line in the domain’s
vhost.conf
file.Ensure that this location is writable by the appropriate user/group permission 777 check your
phpinfo();
to see what it set to. after you made changes.