How to Fix Missing a temporary folder error in WordPress

This error comes when you try to upload media file such as image, video by WordPress browser uploader or flash uploader. WordPress shows this error when temporary upload folder not configured in php.ini file. It is possible upload temp folder is configured but path entered does not exist in the file system. To fix the issue you just need to check and correct temporary path in php.ini file. If path is in-correct you need to correct folder path or if no folder path given then you need to set temporary path.

You can easily fix this by editing php.ini file. Most of the shared hosting provider now support custom php.ini per account. It means you can have you own php.ini and optimize php setting according to your need.

Apply following steps to complete this task.

1) Find out exact physical path of your account public_html folder. Create a text file and name it phpinfo.php. Add below lines in the file. Save file then upload file in the public_html folder of your server.

<?php phpinfo(); ?>

2) Run phpinfo.php file by pointing your browser to the file. http://www.yourdomain.com/phpinfo.php. Replace yourdomain.com with your actual domain  name.

3) Search for two entries _SERVER[“SCRIPT_FILENAME”] and Loaded Configuration File. Note down value against these entries.

In my case value for above entries are

_SERVER[“SCRIPT_FILENAME”]  -> /home/homefolder/public_html/phpinfo.php

Loaded Configuration File -> /etc/php/php.ini

4) If your hosting account support custom php.ini or you have server access then you can complete following steps otherwise you need to ask your hosting company to complete this for you.

If you have server command line access.

  1. Create a temporary folder called “tmp” within your public_html folder from FTP. Now temporary folder path is /home/homefolder/public_html/tmp/
  2. Login into the command prompt as server administrator.
  3. Type below command and hit enter
  4. $ sudo nano /etc/php/php.ini
  5. It will open php.ini file in nano visual editor with root privileges. Enter root password if asked.
  6. Find upload_tmp_dir and un-comment it if commented. “;” used for commenting purpose in php.ini. Simply remove this special character to un-comment line.
  7. Change upload_tmp_dir value to /home/homefolder/public_html/tmp/. You line should appear similar to next line (8).
  8. upload_tmp_dir = /home/homefolder/public_html/tmp/
  9. Save php.ini file and restart apache.
  10. Now again run phpinfo.php file in your browser. New value should appear in your php info setting.

If your host support custom php.ini

  1. Create a temporary folder called “tmp” within your public_html folder from FTP. Now temporary folder path is /home/homefolder/public_html/tmp/
  2. Create a text file called php.ini in your system and paste content in step (8) specified above.
  3. Save file and upload to your public_html folder in your FTP.
  4. Run phpinfo.php file in your browser. New value should appear in your php info setting.

Error should disappear now. However, in some cases you may still get same error. For those cases try removing trailing slash at the end of path. After the change path would be  /home/homefolder/public_html/tmp instead of /home/homefolder/public_html/tmp/

Host Support Custom PHP.INI

  • HostGator
  • aSmallOrange
  • SiteGround
  • Site5

Good Luck

Written by Bala Krishna

Bala Krishna is web developer and occasional blogger from Bhopal, MP, India. He like to share idea, issue he face while working with the code.

This article has 9 comments

  1. CP

    Thank you very very much. This works. As a non-php person, after 2 weeks of trying so many suggestions on the web, tracing the php, re-installing wordpress.

    For info, I am running WordPress 3.3.1 and using Godaddy as host. Using the method described above, I had to add the following entry (as a example) to the php5.ini file found on the root folder of my hosted location

    upload_tmp_dir = /home/content/a/b/c/abc3470/html/tmp

    The biggest problem was not knowing where the php variables were loaded from. After running the php described in this post, I found that the variable was defined in a php5.ini file.

  2. Giladski

    CP this error was probably caused by there not being a tmp folder in the folder below /html
    creating a tmp as follows:
    /home/content/a/b/c/abc3470/tmp
    should also have sorted the error.
    however ftp with Godaddy will take you straight to /html folder but SSH will let you get to your abc3470 folder.

Leave a Comment

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