After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media.
"Missing a temporary folder"
Various articles around the web mention the php setting upload_tmp_dir
needing to be set in php.ini
. This is not actually a requirement. I know because it is not set in our test environment, and it was not set in our production environment before the deploy. In both cases uploads worked.
So what changed?
I have an answer, but I'm not sure it's the definitive answer. I'll post mine.
After we upgraded to Wordpress 3.0.1 (from Wordpress MU 2.9.2) we began getting an error message whenever we tried to upload media.
"Missing a temporary folder"
Various articles around the web mention the php setting upload_tmp_dir
needing to be set in php.ini
. This is not actually a requirement. I know because it is not set in our test environment, and it was not set in our production environment before the deploy. In both cases uploads worked.
So what changed?
I have an answer, but I'm not sure it's the definitive answer. I'll post mine.
upload_tmp_dir
is an optional setting in php.ini
. Php will attempt to use the system default temp directory. So it should just work.
If something happens to the permissions on your temp directory, regardless of wether you set it in php.ini
or use the system default (usually /tmp
on unix like systems), then media uploads will fail. You will see the same error "Missing a temporary folder" if folder doesn't exist, but also if you don't have proper permissions on the temporary directory.
Your web server, Apache or whatever, is probably running as nobody, or some other account with basically no rights to anything. So the first thing to check is that /tmp
is globally writable.
On unix like systems it goes something like this. I'm assuming that your system default temp directory is /tmp
. From the command line
$ ls -l /tmp
lrwxrwxrwx@ 1 root admin 11 Sep 10 11:40 /tmp
The first bit lrwxrwxrwx
should look just like that. No dashes. If not
$ chmod 777 /tmp
and if it gives you permissions errors
$ sudo chmod 777 /tmp
You'll need the root password.
I am answering to this old question, as a lot of people are facing the same issue in 2018. You can fix the missing temporary folder error using cPanel. Follow these steps: Head to cpanel.
A new tab will be opened. Add the following line:
define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');
Now, you will find that the missing temporary folder issue is gone. You can find more information about these steps right here.