4

When trying to upload media to my Wordpress 4.0 running on a shared Apache 2.2.14, PHP 5.3.2 host, I get the error message "Missing a temporary folder". I have no influence over the php.ini which is globally managed by the host and outside my html folder.

I set the WP_TEMP_DIR in wp-config.php. Here is the relevant part of this file:

if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');
require_once(ABSPATH . 'wp-settings.php');
define('WP_TEMP_DIR', ABSPATH . 'wp-content/temp/');

I also tried other variations, such as:

define('WP_TEMP_DIR', '/www/wp-content/temp/'); // absolute path

and:

define('WP_TEMP_DIR', 'wp-content/temp/');

Note that both the folders wp-content and wp-content/temp have the rights 777.

Still, it does not work. Note that whenever I make a change, I log out from admin and log back in. I have no control over the server itself, so I have no clue whether and when my settings in this folder apply.

So my questions:

  1. Should changes in wp-config.php have an immediate effect?
  2. How can I get more feedback within Wordpress than just the error message in the admin page? How can I debug this error?
  3. Do you have any other idea what causes this problem and how to solve it within my shared hosting environment (no console, just FTP and WP admin)?
2
  • Do you have debugging enabled? If so, what do you see?
    – s_ha_dum
    Commented Oct 12, 2014 at 23:32
  • I got my problem solved by this article Try this in case you're facing the same problem.
    – Sam
    Commented Dec 13, 2014 at 15:50

3 Answers 3

10

try to use

get_temp_dir() 

to see if wordpress is using your WP_TEMP_DIR constant.

i've tried this code in wp-config.php and it works

define('WP_TEMP_DIR', dirname(__FILE__) . '/wp-content/temp/');

but you have to put it before the

/* That's all, stop editing! Happy blogging. */

in your wp-config.php file.

1
  • Works like a charm on MediaTemple grid server Commented Apr 15, 2016 at 16:13
2

That message means that the php engine tried and failed to find a directory to which to temporarily store the uploaded file until l they are process by php scripts. Since it is happening before any script is being run it is very unlikely that you will be able to solve this by writing any php code.

You might be able to change the php upload_tmp_dir setting in your .htaccess file but you should just contact the support as this is a server configuration problem even if you might be able to hack around it.

1
  • A very useful answer, with insight I could not get via Google. My solution was rather simple however, so I had to choose my own answer.
    – mcbetz
    Commented Oct 13, 2014 at 9:41
0

The settings itself are all fine. But the rights might be the problem. Change the rights recursively for wp-content to 777. This may raise security concerns and you have to take good care of who can access and write files to this directory.

You may also have to change the rights for the folders wp-admin and wp-includes to 777. Note that is not recommended.

For me, after setting the rights of all three folders, the uploads work again.

Not the answer you're looking for? Browse other questions tagged or ask your own question.