The "Missing a temporary folder" error in WordPress occurs when PHP can't find or write to the temporary directory it uses for file uploads. This prevents you from uploading media, installing plugins, or updating themes. The fix is to define the temp directory explicitly in your WordPress configuration.
Add this line to your wp-config.php file, above the line that says "That's all, stop editing":
define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/tmp/');
Then create the tmp directory inside wp-content/ with permission 755.
01. Why This Happens
When WordPress uploads a file, PHP first writes it to a temporary directory before moving it to the final location. PHP determines this directory from the upload_tmp_dir setting in php.ini. If that setting is empty, PHP falls back to the system temp directory (usually /tmp).
On shared hosting servers, the system /tmp directory is often mounted with restrictions (noexec, quota limits) or is isolated per-account via CloudLinux's CageFS. If PHP can't write to the temp directory for any reason, WordPress shows this error.
02. The wp-config.php Fix
The most reliable fix is to tell WordPress to use its own temp directory inside wp-content/. Edit wp-config.php and add:
define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/tmp/');
Then create the directory:
mkdir ~/public_html/wp-content/tmp
chmod 755 ~/public_html/wp-content/tmp
Or create it through cPanel's File Manager: navigate to wp-content/, click "+ Folder," name it tmp.
This temp directory will accumulate partial upload files over time. Add a cron job to clean it periodically: find ~/public_html/wp-content/tmp/ -type f -mtime +1 -delete
03. Checking PHP's Temp Directory
To see what PHP currently uses as the temp directory, create a temporary phpinfo.php file:
<?php phpinfo(); ?>
Search for upload_tmp_dir in the output. If the "Local Value" is empty or shows a directory that doesn't exist, that confirms the cause. Delete the phpinfo file when done.
You can also set the PHP temp directory through cPanel's "Select PHP Version" > PHP Options > upload_tmp_dir. Set it to /home/username/tmp (create the directory first).
04. Verifying Permissions
Make sure the temp directory and its parents have correct permissions:
ls -la ~/public_html/wp-content/tmp/
# Should show: drwxr-xr-x username username
The directory needs 755 and should be owned by your cPanel username. If the ownership is wrong (e.g., owned by root or nobody), fix it:
chown username:username ~/public_html/wp-content/tmp/
For related upload permission errors, see our guides on unable to create uploads directory and uploaded file could not be moved.
Still Getting the Error?
If defining WP_TEMP_DIR doesn't resolve it, there may be an open_basedir restriction preventing PHP from writing to the directory. Open a support ticket and we'll check the PHP configuration.
Open a Support TicketQuick Recap: Missing Temporary Folder
- Add WP_TEMP_DIR - Define the temp path in wp-config.php
- Create the directory - Make wp-content/tmp/ with 755 permissions
- Check ownership - Directory must be owned by your cPanel user
- Clean periodically - Set a cron to delete old temp files
- Check php.ini - Verify upload_tmp_dir points to a valid, writable path
Last updated March 2026 · Browse all WordPress articles
