- Knowledgebase Home
- » Browse by Service
- » (dv) Dedicated-Virtual Server
- » (dv) 3.0
- » Web Applications
- » PHP and Coding
How do I set the upload_tmp_dir?
Overview
The temporary directory used for storing files when doing a file upload. This directory must be writable by whichever user PHP is running as. If not specified, PHP will use the system's default.
If the directory specified is not writable, PHP falls back to the system default temporary directory. If open_basedir is on, then the system default directory must be allowed for an upload to succeed.
Symptom
I'm getting an upload_tmp_dir error when using PHP. How do I fix this error?
You receive an upload_tmp_dir error when you upload files through PHP.
Solution
This can be done by adding the following line in your php.ini file:
upload_tmp_dir /tmp
Alternatively, if you wish to specify upload_tmp_dir for just one domain, add the following line in the domain's vhost.conf file.
<Directory /path/to/vhosts/example.com/httpdocs>
php_admin_value upload_tmp_dir /tmp
</Directory>
Once the changes have been made to the file, run the command below to make the changes take affect:
websrvmng -a -v