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.
- Create a temporary folder called “tmp” within your public_html folder from FTP. Now temporary folder path is /home/homefolder/public_html/tmp/
- Login into the command prompt as server administrator.
- Type below command and hit enter
- $ sudo nano /etc/php/php.ini
- It will open php.ini file in nano visual editor with root privileges. Enter root password if asked.
- 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.
- Change upload_tmp_dir value to /home/homefolder/public_html/tmp/. You line should appear similar to next line (8).
- upload_tmp_dir = /home/homefolder/public_html/tmp/
- Save php.ini file and restart apache.
- 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
- Create a temporary folder called “tmp” within your public_html folder from FTP. Now temporary folder path is /home/homefolder/public_html/tmp/
- Create a text file called php.ini in your system and paste content in step (8) specified above.
- Save file and upload to your public_html folder in your FTP.
- 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
Your post is very informative. I really need this one. Thank you for sharing this article.
thanks for this article correctly pointing at the php config files!
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.
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.
nice post it well me lot no 1 has solution for this problem
This is working Perfectly.
Thanks Buddy
It worked for me like a charm.Thanks a ton 🙂
After days of headaches I finally found a solution. Thank You very much. 🙂
But where is the command prompt . I don’t see it in cpanel