Title: Missing a temporary folder.
Last modified: December 19, 2017

---

# Missing a temporary folder.

 *  [rahvee](https://wordpress.org/support/users/rahvee/)
 * (@rahvee)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/)
 * I’m actually a fairly advanced developer and sysadmin, but this was driving me
   nuts, and I’m posting here to hopefully make the current top search result (which
   is wrong) eventually become less prevalent.
 * I was getting the `Missing a temporary folder.` error message, and I searched
   for that message, and found various posts about it on these forums, which suggested(
   amongst other things) creating a line like this in `wp-config.php`:
 * `/* don't do this; it's wrong */`
    `define(‘WP_TEMP_DIR’, dirname(__FILE__) .‘/
   wp-content/temp/’);`
 * I debugged the `get_temp_dir()` function in `wp-includes/functions.php` and found
   the `'WP_TEMP_DIR'` setting wasn’t being used. Tracked it all down, and the problem
   is the stylized unicode quote characters in the above line.
 * The following line is correct, using normal quotes that I typed with my keyboard,
   and which MS word, or email, or gmail, or whatever, have not stylized with autocorrect.
   Hopefully it’s not wordpress.org that’s stylizing the quotes, so these quotes
   will come out unmodified by the time anyone reads it:
 * `define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');`
 * I tried to post responses to the other threads (google results) where people 
   are having this problem, but they are closed for additional comments.
 * Of course, what directory you use for your temp dir depends on the system where
   you’re hosting your wordpress site. The temp directory must be writable by the
   apache or nginx process. In the above example, I have such a directory named `
   wp-content/temp`
 * Happy wordpressing to all.
    -  This topic was modified 8 years, 4 months ago by [rahvee](https://wordpress.org/support/users/rahvee/).
      Reason: formatting

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [kjodle](https://wordpress.org/support/users/kjodle/)
 * (@kjodle)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-9798126)
 * Which version of WordPress is this? I’m not finding [this line in 4.9.1](https://develop.svn.wordpress.org/tags/4.9.1/src/wp-includes/functions.php).
 *  Thread Starter [rahvee](https://wordpress.org/support/users/rahvee/)
 * (@rahvee)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-9803075)
 * If you `define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');` in the`
   wp-config.php` file, then it should take effect in `get_temp_dir()` function 
   in `wp-includes/functions.php`.
 * Sometimes you might need to do this, to specify a custom temp dir, to resolve
   the `Missing a temporary folder` error message.
 * In previous posts on this forum, found by googling and using the search function
   on this forum to find the `Missing a temporary folder` error message, people 
   have pasted the `define` line, using unicode quote-like characters, instead of
   the actual ASCII single quote characters. This is almost indistinguishable to
   a human reading the code (depending on your font), but the end result if you 
   paste the wrong quote type into your `wp-config.php` file is `WP_TEMP_DIR` has
   no effect.
 *  [dhakanursery](https://wordpress.org/support/users/dhakanursery/)
 * (@dhakanursery)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-9904114)
 * I have followed all instructions given here but the problem has not yet been 
   solved. Please help me.
 *  [stmux](https://wordpress.org/support/users/stmux/)
 * (@stmux)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-9950574)
 * I copy and pasted the define line with the proper quotes and still not working.
   Deactivated all plugins and updated to ver 4.94 and no joy. Help!
    jay
 *  Thread Starter [rahvee](https://wordpress.org/support/users/rahvee/)
 * (@rahvee)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-9952040)
 * When you see the “missing a temporary folder” error, it just means wordpress 
   was unable to write to the temp folder – either because it’s not defined, or 
   because the user nginx or apache httpd runs as doesn’t have write permission 
   in the target directory.
 * The problem could be permission bits (you can try `chown` or `chmod` on the target
   directory) or selinux or apparmor.
 * First, figure out what directory the system is trying to use (described below),
   and then check what user the web server is running as, and check the permissions
   on the target directory. If permissions look good, consider if selinux is enforcing
   by running (as root or sudo) `sestatus` and if it’s enforcing, you might have
   to change the target directory’s selinux context. If you’re on a debian/ubuntu
   variant of linux, you might have apparmor running. I don’t know how to check 
   status on that one; you’ll have to google it or something.
 * If you want to confirm which directory your wordpress is using for temp, there
   might be an easier way than this, but I was able to edit `wp-includes/functions.
   php`, find the function `get_temp_dir()`, and everywhere it says “return” stick
   a line just above it to display what’s getting returned. You can use `error_log()`,
   or `echo`, or `print`.
 *  [stmux](https://wordpress.org/support/users/stmux/)
 * (@stmux)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-9958913)
 * In my case I am running WP 4.94 on a local Windows 7 Enterprise Server. This 
   problem began with the version prior to upgrading to 4.94. The strange thing 
   with this problem is that the upgrade to 4.94 downloaded and installed perfectly
   via ftp. Updates for plugins are also downloading and installing with no problem.
   Why would this be isolated to only uploading images? BTW, since I am on a local
   connection I can use the “Add From Server” plugin to import images locally on
   the LAN. The problem arises when an Author tries to upload images remotely.
    
   Thanks for your suggestions and insight, jay
 *  [stmux](https://wordpress.org/support/users/stmux/)
 * (@stmux)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-9958969)
 * I finally figured out what the problem was. The hint was that php defines the
   temp folder. I found that on the Windows installation php is defaulting to C:\
   windows\temp. Then I checked the user permissions and NO permissions were set
   for that folder. Setting the permissions resolved the issue.
    Thank you again
   for steering me in the right direction. jay
 *  [rimultd](https://wordpress.org/support/users/rimultd/)
 * (@rimultd)
 * [8 years, 2 months ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-10001744)
 * Missing a temporary folder.
 * all process I have tried but I can’t find solution yet. how can fix Missing Tem
   folder error?
 *  [kron1986](https://wordpress.org/support/users/kron1986/)
 * (@kron1986)
 * [8 years ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-10252331)
 * I have tried all that is mentioned above but it still does not want to work. 
   I am still getting the “missing a temporary folder” error. Any other options 
   to solve this problem?

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Missing a temporary folder.’ is closed to new replies.

## Tags

 * [missing a temporary folder](https://wordpress.org/support/topic-tag/missing-a-temporary-folder/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 6 participants
 * Last reply from: [kron1986](https://wordpress.org/support/users/kron1986/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/missing-a-temporary-folder-36/#post-10252331)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
