Solution — Fix Missing Temporary Folder WordPress Error

Common solutions to the “Missing a temporary folder” error in the WordPress dashboard, mainly when uploading new files and images.

Missing a Temporary Folder

While it’s more frequent to have this error on new installs of WP, the message can appear all of a sudden with old installs that have worked before as well. Contacting your server administrator is always a smart thing to do as this can be a problem with PHP misconfigurations for example.

To fix this yourself, there are two common methods. Each which might or might not work depending on the situation.

Define WP_TEMP_DIR

Define WP_TEMP_DIR

An easy way is to add the following line to wp-config.php and make sure that the path defined in that line exists. Note that there is no need to set chmod 777 user permissions for directories or files. This would be a security risk.

define('WP_TEMP_DIR',ABSPATH.'/temp/');

It is said to work when placed above the /* That’s all, stop editing! */ line.

Define upload_tmp_dir in PHP.ini

php.ini upload_tmp_dir temp folder

Many providers allow the creation of php.ini over-rides. Which gives the ability to define your own upload_tmp_dir. The process is different depending on the server, but often it is as easy as placing a php.ini file with the following line inside the http base directory (aka. public_html, htdocs) or your home directory.

upload_tmp_dir= /home/user/public_html/temp/

Where the user is the username of your account, relative to the absolute path (root). Also make sure the directory defined exists.

To find the absolute path, if you have shell access just type “echo $HOME”, or save a file named “path.ini” with the following contents. Open the file with your browser and it will display the correct, full path to your home directory.

<?php
$path = getcwd();
echo “Absolute Path: “;
echo $path;
?>

PS. In some cases, you need to use a uPHP configPath directive which points the correct directory for the php.ini, by adding “suPHP_configPath /home/user/” to the .htaccess file.

Hope this helps.

Twitter Button Facebook Button Google Button LinkedIn Button

Leave a Reply

Your email address will not be published. Required fields are marked *