Download failed. Failed to write request to temporary file

Just had an issue with updating all plugins on a Dreamhost VPS. None would update. All plugins showed this error when I tried to update them:

Download failed. Failed to write request to temporary file.

A bad start of my morning. Fortunately Dreamhost has great live chat any time of the day and they confirmed what I found out Googling. Apparently the /tmp folder had reached its 128MB max (Dreamhost set limitation. This was due to too many left over files in the folder. This caused issues and that is why the server failed to write request to temporary file, meaning the /tmp directory.

Cause TMP folder Issues & Solutions

The pile up had probably been caused by plugins or PHP misbehaving. Dreamhost staff member Vince emptied the folder for me. He told me for future reference that I could also restart the VPS if I ran into this issue again in the future. Below I will show why that is for my situation. If you do have full access to the server you can just manually empty it yourself of course. No need to reboot in that case.

Ubuntu and /tmp

Dreamhost VPSs run Ubuntu 12.0.4 LTS. I found a good SO explanation how the emptying works for Ubuntu versions before 14.0.4:

The cleaning of /tmp is done by the upstart script /etc/init/mounted-tmp.conf. The script is run by upstart everytime /tmp is mounted. Practically that means at every boot.

The script does roughly the following: if a file in /tmp is older than $TMPTIME days it will be deleted.

The default value of $TMPTIME is 0, which means every file and directory in /tmp gets deleted. $TMPTIME is an environment variable defined in /etc/default/rcS.

So as Vince said rebooting does do the job. In 14.0.4 up it is taken care of by tmpreaper.

Locate tmp directory

If you would like to find out what temporary directory is you can use the following PHP function:


See PHP manual details here. In case the location it uses does not work you can set another location adding something like the following to wp-cponfig.php:

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

Found information on this in this WordPress Stack Exchange thread.

Jasper Frumau

Jasper has been working with web frameworks and applications such as Laravel, Magento and his favorite CMS WordPress including Roots Trellis and Sage for more than a decade. He helps customers with web design and online marketing. Services provided are web design, ecommerce, SEO, content marketing. When Jasper is not coding, marketing a website, reading about the web or dreaming the internet of things he plays with his son, travels or run a few blocks.