/tmp problem when installing plugins in WordPress
When you try to install a plugin in WordPress and get an error message like this:
Warning: file_exists() [function.file-exists]: open_basedir restriction in effect. File(/tmp//google-integration-toolkit.tmp) is not within the allowed path(s): (/var/www/XXX/) in/var/www/XXX/web/wp-includes/functions.php on line 2140
Warning: touch() [function.touch]: SAFE MODE Restriction in effect. The script whose uid is 12345 is not allowed to access /tmp owned by uid 0 in /var/www/XXX/web/wp-admin/includes/file.php on line 184
Download failed. Could not create Temporary file.
This is happening when the server is running with SAFE MODE because WordPress will not be able to access paths outside it’s web root. Find out the full path to your web root on the server (a hint is in the error message you just saw). Create a temporary directory within your website path and add the following line.
Edit wp-config.php and add:
define(‘WP_TEMP_DIR’, ‘/var/www/XXX/tmp’);
(Replace /var/www/XXX/tmp with the full path to your temporary directory.)
I went into cpanel, edited my document root, but left it the same. The act of re-linking the document root fixed my issue. It seems after a wordpress update done through wordpress not cpanel caused the issue. CPanel I use uses softalicious to install wordpress among many things. So keep this in mind when an update to wordpress becomes available, update your wordpress from cpanel, not through wordpress…or just relink your document root after an upgrade.