
Why use WooCommerce? The top benefits for small to medium businesses
May 6, 2026
Great Travel WordPress Themes You Can’t Miss
May 9, 2026You try to upload an image or install a plugin and WordPress stops cold with a file upload failure. No warning. No obvious reason.
The "Missing a Temporary Folder" error is a PHP configuration problem. It fires when WordPress cannot find a writable temp directory to stage files before moving them to their final location.
It shows up on shared hosting, VPS servers, and post-migration setups alike. The upload_tmp_dir directive is either unset, pointing to a broken path, or blocked by server write permissions.
This guide covers how to fix the WordPress missing a temporary folder error across every common server environment, including fixes for php.ini, wp-config.php, Apache, and Nginx.
What Is the WordPress "Missing a Temporary Folder" Error?
The WordPress "Missing a Temporary Folder" error is a PHP-level file system failure. It fires when WordPress cannot locate or write to a temporary directory during file uploads, plugin installs, theme installs, or core updates.
PHP handles every file upload in two stages. First it writes the file to a temp directory. Then it moves that file to the final destination, usually wp-content/uploads. If that first stage fails, the entire upload process stops and WordPress throws this error.
WordPress powers 43.4% of all websites on the internet as of 2025 (W3Techs). That scale means this error surfaces across millions of hosting environments, from shared cPanel setups to managed VPS servers running Nginx and PHP-FPM.
The error is distinct from the "Unable to Create Directory" message. That one targets the final uploads path. This one targets the temporary staging area PHP uses before anything reaches wp-content/uploads at all.
PHP uses the sys_get_temp_dir() function to identify where temporary files go. If the path that function returns is missing, unwritable, or blocked by open_basedir restrictions, WordPress cannot complete uploads or package-based installs.
The exact error string WordPress displays is: "Unable to create directory wp-content/uploads/... Is its parent directory writable by the server?". Some hosting environments surface it slightly differently, but the root cause is always the same: no accessible temp directory for PHP to use.
What Causes the Missing Temporary Folder Error in WordPress?
There are 4 distinct root causes for this error. Identifying which one applies before attempting a fix saves a lot of trial and error.
| Root Cause | Where It Comes From | Most Common On |
|---|---|---|
upload_tmp_dir not set |
php.ini missing the directive entirely |
Shared hosting, new VPS setups |
| Temp path unwritable | Directory exists but server user lacks write access | All environments after migrations |
| Path deleted or reset | Old path from previous server no longer exists | Post-migration setups |
| WP\TEMP\DIR misconfigured | wp-config.php constant pointing to a non-existent path |
Manually configured WordPress installs |
Shared hosting environments are the most common trigger. Many shared hosts restrict access to the system's default /tmp directory for PHP processes. The PHP process runs under a user like www-data or a server-assigned account that has no write access to the global temp path.
After a WordPress migration, this error frequently appears because the upload_tmp_dir in php.ini still points to the old server's directory structure. That path does not exist on the new server, so every upload attempt fails immediately.
A misconfigured WP_TEMP_DIR constant in wp-config.php produces the same result. If a developer hardcoded a custom path that was later removed or renamed, WordPress cannot find the temp folder even when PHP's own config is correct.
Run phpinfo() on your server to check the current value of upload_tmp_dir and sys_temp_dir. If either shows "no value" or a path that does not exist, you have found your cause.
How to Fix the Missing Temporary Folder Error by Setting upload\tmp\dir in php.ini
Setting upload_tmp_dir in php.ini is the primary server-level fix. It resolves the error for any environment where the PHP configuration file is editable and the directive is missing or pointing to a broken path.
How to Find the Active php.ini File Location
Create a temporary PHP file in your WordPress root with the content <?php phpinfo(); ?> and open it in a browser.
Look for the row labeled "Loaded Configuration File". The full path to the active php.ini is listed there. On shared hosts running cPanel (SiteGround, Bluehost, HostGator), this is typically inside your home directory rather than at the server root.
Delete the phpinfo() file immediately after checking. Leaving it on a live server exposes full PHP configuration details to anyone who knows the URL.
How to Set upload\tmp\dir Correctly
Add or update this line in the active php.ini:
upload_tmp_dir = /tmp
Before saving, confirm the path actually exists on your server. Connect via SSH and run ls -la /tmp. If the directory is missing, either create it or substitute a valid writable path your PHP process can access.
After saving php.ini, restart the web server to apply changes:
- Apache:
sudo systemctl restart apache2 - PHP-FPM:
sudo systemctl reload php8.x-fpm
Confirm the fix by reloading phpinfo() and verifying that upload_tmp_dir now shows the correct path. Then test with a real upload in wp-admin.
How to Fix the Error Using a php.ini File in the WordPress Root
On shared hosting, the main php.ini is locked. The fix here is creating a custom php.ini inside the WordPress directory itself.
Create a file named php.ini in the WordPress root (the same directory as wp-config.php) with this single line:
upload_tmp_dir = /tmp
Most cPanel-based hosts support per-directory php.ini overrides. Hosts like SiteGround, Bluehost, and HostGator use this approach as standard. If uploads happen in the wp-admin area and the error persists, place a second copy of the file inside the wp-admin/ directory as well.
Not all shared hosts honor per-directory php.ini files. Check your hosting documentation before spending time on this approach. If the host uses a .user.ini system instead (common with FastCGI setups), rename the file to .user.ini and use the same directive.
To verify it worked: reload phpinfo() from the WordPress root and check the "Local Value" column for upload_tmp_dir. Local Value overrides Master Value, so if it shows your path, the per-directory config is active.
How to Fix the Error Using .htaccess on Apache Servers
On Apache servers running mod_php, the .htaccess file accepts PHP directives directly. This makes it a workable fix when neither the main php.ini nor per-directory files are accessible.
Add this line to the .htaccess file in the WordPress root:
php_value upload_tmp_dir /tmp
This method has hard limits. It does not work on:
- Nginx servers (Nginx ignores
.htaccessentirely) - PHP-FPM setups (even on Apache)
- Hosts where
AllowOverrideis set toNone
Back up your .htaccess file before editing. A single syntax error breaks your entire site with a 500 Internal Server Error. After saving, test the site immediately by loading the homepage before testing any uploads.
Verify which server and PHP handler your host uses before attempting this. The quickest way: check phpinfo() for the "Server API" row. If it shows "Apache 2.0 Handler," this method applies. If it shows "FPM/FastCGI," skip to the wp-config.php fix or the PHP-FPM pool method instead.
How to Fix the Error by Defining a Custom Temp Path in wp-config.php
The WP_TEMP_DIR constant in wp-config.php gives WordPress its own temp directory, completely separate from PHP's upload_tmp_dir. This is the most reliable fix when server-level access is unavailable.
Adding the WP\TEMP\DIR Constant
Open wp-config.php via FTP, SSH, or cPanel File Manager. Add this line before the comment that reads "That's all, stop editing! Happy publishing":
define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp/');
Save the file and upload it back to your server. Then navigate to wp-content/ and create a new folder named temp.
Setting the Correct Folder Permissions
Set permissions on the new temp folder to 755. Not 777. Using 777 makes the directory world-writable, which creates a security risk on any shared server environment.
In FileZilla: right-click the folder, select "File Permissions," enter 755, and apply. In cPanel File Manager: right-click the folder, choose "Change Permissions," and set Owner/Group/World to the correct values.
The WP_TEMP_DIR constant bypasses PHP's own upload_tmp_dir directive entirely. WordPress checks for this constant first using its internal get_temp_dir() function, so even if the PHP-level config is broken, WordPress uses this path instead.
Hostinger's documentation confirms this as a working fix for the missing temporary folder error across their shared hosting plans (Hostinger, 2025).

How to Fix Folder Permission Errors That Trigger This Problem
Even when upload_tmp_dir is correctly set, the error still fires if the temp directory exists but is unwritable by the PHP process. Permissions and the error are two separate problems that look identical from the WordPress admin side.
How to Check and Set Permissions via SSH
Run this command to check current permissions on the temp path:
ls -la /tmp
The output shows the directory owner, group, and permission bits. The PHP process user (typically www-data on Ubuntu/Debian, apache on CentOS) needs write access. If the directory is owned by root and the PHP user is not in the same group, writes will fail.
To find your PHP process user, check the "User/Group" row in phpinfo(). Then apply the correct permissions:
chmod 755 /path/to/temp
How to Set Permissions Using cPanel File Manager
Log into cPanel and open File Manager. Navigate to the wp-content/ directory.
- Right-click the
tempfolder - Select "Change Permissions"
- Set to 755 (Owner: read/write/execute, Group: read/execute, World: read/execute)
- Apply and test with a media upload in wp-admin
On managed WordPress hosts like WP Engine, Kinsta, and Flywheel, server permissions are locked and cannot be changed through FTP or cPanel. If you are on a managed host and this error appears, contact their support team directly. These platforms typically resolve it by adjusting the PHP-FPM pool configuration on their end.
If you are dealing with other related upload failures alongside this error, a broader issue with WordPress not being able to upload images at the server level may be involved. That covers permission and configuration failures that affect the entire media upload workflow, not just the temp directory.
How to Fix the Error on Nginx Servers
Nginx ignores .htaccess entirely. The php_value directive that works on Apache has zero effect on any Nginx setup, including shared Nginx hosts and cloud VPS instances.
The correct fix for Nginx depends on how PHP runs behind it. Most modern Nginx setups use PHP-FPM, which has its own pool configuration separate from php.ini.
| PHP Setup | Where to Set upload\tmp\dir | File to Edit |
|---|---|---|
| PHP-FPM (most common) | Pool config file | /etc/php/8.x/fpm/pool.d/www.conf |
| php.ini (global) | Main PHP config | /etc/php/8.x/fpm/php.ini |
| Per-site pool | Site-specific pool file | /etc/php/8.x/fpm/pool.d/yoursite.conf |
Setting upload\tmp\dir in the PHP-FPM Pool File
Open the active pool file (typically www.conf) and add this line inside the pool block:
php_admin_value[upload_tmp_dir] = /tmp
Note the syntax difference from php.ini. PHP-FPM pool files use php_admin_value[directive] bracket notation, not plain directive = value. Using the wrong syntax here causes PHP-FPM to fail on restart.
After saving the pool file, reload PHP-FPM to apply the change:
sudo systemctl reload php8.x-fpm
Replace 8.x with the PHP version your server runs. Check with php -v if you are not sure. DigitalOcean's PHP-FPM configuration documentation confirms that env[TMP] = /tmp can also be set in the pool to make the temp path available as an environment variable alongside the php_admin_value directive.
Verifying the Change on Nginx
Reload phpinfo() after restarting PHP-FPM. Check the "Local Value" for upload_tmp_dir.
If the value has not updated, the pool file you edited may not be the active one. Check which pool file PHP-FPM is loading by running:
php-fpm8.x --test
This outputs the configuration files PHP-FPM reads on startup, including the correct pool directory path for your server.
How to Fix the Error After a WordPress Migration
Post-migration setups are the second most common trigger for this error. The server changes, but the temp directory configuration does not update to match the new environment.
Hosted.com's WordPress migration documentation notes that most post-migration issues come from configuration mismatches between old and new hosting environments, with wp-config.php and server-level PHP settings being the primary sources of breakage (Hosted.com, 2025).
What Breaks During Migration
Hardcoded WP\TEMP\DIR: A wp-config.php from the old server may contain a WP_TEMP_DIR constant pointing to a directory path that does not exist on the new server.
Old upload\tmp\dir path: The php.ini on the new server may reference a temp directory path used on the old server, which was never created in the new environment.
Restricted /tmp access: The new host may apply tighter open_basedir restrictions than the previous one, blocking PHP from accessing /tmp even when the path exists.
Migration Fix Checklist
Run through these 4 checks in order before attempting any config edits:
- Open
wp-config.phpand search forWP_TEMP_DIR. If it exists, verify the path is valid on the new server. - Run
phpinfo()on the new server and record the actualsys_temp_dirvalue. - Check Settings > Media in wp-admin to confirm the uploads path matches the new server's directory structure.
- Ask the new host whether
open_basedirrestrictions apply to the PHP process for your account.
Kinsta, WP Engine, and Flywheel all use custom PHP-FPM pool configurations per site. After migrating to any of these managed hosts, the temp directory is set at the infrastructure level. Contact their support rather than editing config files directly.
If you are troubleshooting upload issues that persist after a migration alongside this error, checking whether WordPress images are not displaying correctly can confirm whether the problem is limited to the temp path or has spread to the uploads directory itself.
How to Verify the Fix Is Working Correctly
Testing the fix is not optional. A configuration change that looks correct in phpinfo() can still fail in practice because of permission conflicts, caching layers, or a second php.ini file overriding the one you edited.
Three Tests to Confirm the Fix
Test 1: Media upload. Go to Media > Add New in wp-admin and upload a JPEG or PNG. A successful upload with no error message confirms the temp directory is accessible.
Test 2: Plugin install. Go to Plugins > Add New, search for any plugin, and click Install Now. This forces WordPress to download a zip file to the temp directory and extract it. Harder than a simple media upload.
Test 3: Core update (if available). Run a WordPress core update from Dashboard > Updates. Core updates are the most demanding test because they download, extract, and replace multiple files using the temp directory. If this completes without error, the fix is confirmed at every level.
Checking the WordPress Debug Log
Enable the WordPress debug log by adding these 3 lines to wp-config.php:
define('WP_DEBUG', true);
define('WP_DEBUG_LOG', true);
define('WP_DEBUG_DISPLAY', false);
The log file writes to wp-content/debug.log. After running a test upload, check this file for any PHP warnings containing "temp," "tmp," or "upload\tmp\dir."
WordPress developer documentation confirms that WP_DEBUG_LOG writes all PHP errors, notices, and warnings to wp-content/debug.log with timestamps (WordPress.org Developer Docs). If the log is clean after an upload test, the temp directory issue is fully resolved.
Remove or disable the debug constants after testing. Leaving WP_DEBUG active on a live production site exposes PHP error details publicly if WP_DEBUG_DISPLAY is accidentally set to true.
If the error returns after a server restart or PHP-FPM reload, the fix was applied to a config file that gets overwritten by the host on restart. That points to a managed hosting environment where temp directory settings are controlled at the infrastructure level. Contact the host directly.
For upload errors that persist even after the temp directory is fixed, a separate issue with the HTTP error during WordPress image uploads may be the cause. That error has a different root cause involving server memory limits and image processing libraries rather than the temp path itself.
FAQ on How To Fix The WordPress Missing A Temporary Folder Error
What causes the WordPress "Missing a Temporary Folder" error?
The error fires when PHP cannot locate a writable temp directory. The upload_tmp_dir directive in php.ini is either unset, points to a non-existent path, or the PHP process user lacks write permission to the defined directory.
How do I fix the missing temporary folder error in WordPress?
The fastest fix is adding define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp/'); to wp-config.php, then creating the temp folder inside wp-content/ with 755 permissions. This bypasses the PHP-level config entirely.
Does this error affect plugin and theme installations?
Yes. WordPress uses the temp directory to stage every file it downloads, including plugin zips, theme packages, and core update files. Without a writable temp path, all three installation types fail at the extraction stage.
Can I fix this without accessing php.ini?
Yes. The WP_TEMP_DIR constant in wp-config.php is the standard workaround when php.ini is locked by the host. Create the matching folder manually and set permissions to 755. No server-level access needed.
Why does this error appear after a WordPress migration?
After migration, the old server's upload_tmp_dir path no longer exists on the new server. WordPress tries to write to a missing temp directory, finds nothing writable, and throws the error immediately on any file upload or update attempt.
What file permissions should the temp folder have?
Set the temp directory to 755. That gives the owner full access and read/execute access to the group and public. Never use 777 on a shared server. It makes the directory world-writable and creates a real security risk.
Does this error appear on Nginx servers too?
Yes. On Nginx with PHP-FPM, set upload_tmp_dir inside the pool file using php_admin_value[upload_tmp_dir] = /tmp. The .htaccess method does not work on Nginx. Reload PHP-FPM with sudo systemctl reload php8.x-fpm after saving.
How do I check if my temp folder fix actually worked?
Run three tests: upload an image via Media > Add New, install a plugin from the repository, and check phpinfo() to confirm upload_tmp_dir shows the correct path. A passing core update is the strongest confirmation.
Can a shared hosting environment cause this error specifically?
Shared hosts often restrict PHP process access to the global /tmp directory using open_basedir rules. The PHP runtime cannot write temp files there, even when the path exists. A per-directory php.ini or the WP_TEMP_DIR fix resolves it.
Is the "Missing a Temporary Folder" error the same as the uploads directory error?
No. The uploads directory error targets wp-content/uploads and its parent path. The missing temporary folder error targets the PHP temp staging area used before files reach the uploads folder. Different paths, different fixes, same frustrating outcome.
Conclusion
This conclusion is for an article on how to fix the WordPress missing a temporary folder error, and the core takeaway is straightforward: the fix is always a configuration problem, not a WordPress bug.
Whether the issue is a missing WP_TEMP_DIR constant, a broken upload_tmp_dir path, or a post-migration mismatch between server environments, every root cause has a direct solution covered here.
Start with the wp-config.php fix. It works across shared hosting, Apache, and Nginx without requiring server-level access.
If the PHP runtime on your server uses PHP-FPM, set php_admin_value[upload_tmp_dir] in the pool file instead.
Always verify with a real upload test and check wp-content/debug.log for residual PHP warnings before closing out the fix.





















