Ffile2fix
Sign in Get started

How to fix "Missing a temporary folder" in WordPress

Missing a temporary folder.

PHP first saves every uploaded file to a temporary directory before WordPress moves it into wp-content/uploads. This message is PHP upload error 6 (UPLOAD_ERR_NO_TMP_DIR): the configured temp folder does not exist or PHP cannot write to it.

Also appears as: Upload failed: Missing a temporary folder. · The uploaded file could not be moved to wp-content/uploads. · UPLOAD_ERR_NO_TMP_DIR (PHP upload error 6)

Common causes

  • upload_tmp_dir in php.ini points to a folder that does not exist
  • The system /tmp directory is full, removed or has wrong permissions
  • open_basedir restrictions exclude the temp directory
  • A server migration or PHP version change reset the PHP configuration
  • Systemd PrivateTmp or container setups giving PHP-FPM a temp dir that was cleaned

How to fix it

  1. Check the active temp setting. Look at upload_tmp_dir and sys_temp_dir in Site Health > Info > Server or a temporary phpinfo() page. An empty value means PHP falls back to the system temp directory.
  2. Create a private temp folder. Create a folder outside public_html, for example /home/user/tmp, owned by your account with permissions 750 or 755. Avoid placing it inside the web root.
  3. Point PHP at it. Set upload_tmp_dir to that folder in cPanel MultiPHP INI Editor, hPanel PHP options, php.ini or .user.ini. Make sure it is inside any open_basedir paths.
  4. Set WP_TEMP_DIR as well. Add define('WP_TEMP_DIR', '/home/user/tmp'); to wp-config.php so WordPress uses the same folder for plugin and core update downloads.
  5. Check disk space. Run df -h on a VPS or check disk usage in the hosting panel. A full disk or a full /tmp partition causes the same error.
  6. Restart PHP-FPM on a VPS. After changing php.ini, restart PHP-FPM (e.g. systemctl restart php8.3-fpm) and retry the upload.

php.ini / .user.ini and wp-config.php

; php.ini or .user.ini
upload_tmp_dir = /home/user/tmp

// wp-config.php
define( 'WP_TEMP_DIR', '/home/user/tmp' );

How to stop it happening again

  • Document custom PHP settings so they are reapplied after migrations
  • Monitor disk usage and clean old backups from the account
  • Keep temp directories outside the public web root

Frequently asked questions

Can I just chmod /tmp to 777?

Do not change system /tmp permissions yourself on shared hosting; contact the host. On your own server, /tmp should already be 1777 with the sticky bit, and the fix is usually a wrong upload_tmp_dir, not permissions.

Why does it only fail for some uploads?

If the temp partition is nearly full, small files may succeed while larger files fail. Check free space on the partition holding the temp directory.

Does this affect plugin updates too?

Yes. Updates are downloaded to a temp location first, which is why setting WP_TEMP_DIR to a writable folder often fixes failing updates as well.