Fix Failed WP Plugin Installation In Safe Mode

When using the new auto plugin installer in WordPress it failed miserably with the following error message:

Downloading install package from http://downloads.wordpress.org/plugin/addthis.1.6.6.zip…

Warning: touch() [function.touch]: SAFE MODE Restriction in effect. The script whose uid is 587 is not allowed to access /tmp owned by uid 0 in /long-path/wp-admin/includes/file.php on line 199

Download failed. Could not create Temporary file.

What to Do?

After some searching I found a simple solution: Just create a new temporary folder in your web root (often called public_html) folder and point WordPress to this new folder.

How Do I Change the /tmp Folder Then?

That’s Easy!

Just add the following line to your wp-config.php

define('WP_TEMP_DIR','/your_path/public_html/tmp');

And make sure to use the name of the folder where WordPress is installed or the root html folder. And also make sure you have created the tmp folder and chmod it to 777 before adding the define to wp-config.php

This is all there is to do, enjoy!