Last week I posted that I was having problems upgrading or updating WordPress core and plugins. Every attempt resulted in the message – “Download failed. Could not create Temporary file”. The only solution at the time was to change permissions on wp-content to 0777 and then to revert to 0755 after.
I have finally found a definitive answer that does not require changing permissions or ownerships. or does it compromise the security of the server.
The solution is quite simple. All that is required is to add the following two lines to the wp-config.php file.
define('WP_TEMP_DIR', ini_get('upload_tmp_dir'));
putenv('TMPDIR=' . ini_get('upload_tmp_dir'));
As I said, I run several sites, so it was a matter of updating each config file. I then attempted a core upgrade and a plugin upgrade on each. Success! No more meddling with directory permissions.
So, if anyone out there is having the same problem – there is the answer.