Missing a temporary folder despite settings in wp-config.php

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__) . "https://wordpress.stackexchange.com/");
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)?

3 Answers
3

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.

Leave a Comment