• 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. Reason: formatting
Viewing 9 replies - 1 through 9 (of 9 total)
  • Which version of WordPress is this? I’m not finding this line in 4.9.1.

    Thread Starter rahvee

    (@rahvee)

    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.

    I have followed all instructions given here but the problem has not yet been solved. Please help me.

    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

    (@rahvee)

    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.

    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

    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

    Missing a temporary folder.

    all process I have tried but I can’t find solution yet. how can fix Missing Tem folder error?

    kron1986

    (@kron1986)

    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.