Support / KnowledgeBase

 
Search the KnowledgeBase Search

How do I set the upload_tmp_dir?

  • Applies to: All (dv)

  • Difficulty: Medium

  • Time needed: 10 minutes

  • Tools needed: SSH, root access, vi knowledge

 
  • Applies to: All (dv)
    • Difficulty: Medium
    • Time Needed: 10
    • Tools Required: SSH, root access, vi knowledge

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

Resources


User Comments

No visitor comments posted. Post a comment
Fields marked with an asterisk(*) are required. Comment on this article
Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue