Home WordPress WordPress Update Error: Failed to write request to temporary file

WordPress Update Error: Failed to write request to temporary file

by admin

One of the WordPress plugins I use on two sites had an update. On the first site, it updated fine as always. On this site (which is hosted on a different server), the plugin update failed with an error message that I had not seen until today.

An error occurred while updating Simple Share Buttons Adder: Download failed. Failed to write request to temporary file.

Sometimes WordPress file and permission errors can be tricky but the solution for this was pretty simple.

 

Why it happens

During updates, WordPress places temporary files in a directory designated by the server’s configuration. This is not a directory specific to WordPress. It is available for all software to use as needed. Neither is this a plugin or theme issue. It is simply the result of needing more space in a directory than is available. It is common for hosts to limit the total file size of the tmp directory they make available for your sites to use.

Temporary files should normally be cleared out of tmp automatically after use but old files often get left behind, causing more space to be used than necessary. My hosting provider’s control panel shows me the path to my tmp directory and how much storage space it uses. 30 MB is apparently the limit for tmp in Media Temple’s shared hosting. Your host probably has a different limit.

What worked for me

To solve the problem of failing to write temporary files during a WordPress update, you will need to delete some files in your tmp directory.

You can do this by logging into your server via SFTP. Your host may also provide a file manager in their control panel. Be careful as there may be folders and files in your tmp directory that are currently in use (such as sessions) or that always need to remain there (such as for statistics). If you are unsure what is or is not safe to delete, play it safe and contact your host.

But, where is my tmp directory?

If you aren’t sure where your tmp directory is, SFTP into the server and poke around a bit. With Media Temple, my sites share a directory for temporary files at /data/tmp. Your host probably uses a different path. If you do not find it, check your control panel and search your host’s knowledge base. You may or may not have access to the tmp directory so if all else fails, contact your web host and ask them to clear it out.

Another solution

I have seen others recommend defining an alternate tmp directory path using the WP_TEMP_DIR constant in wp-config.php. This is not wrong but it seems like treating the symptom instead of solving the problem. Why complicate your setup if you do not have to?

Did it work for you?

Let me know in a comment if you encountered this problem and if this solution worked for you. If you have a better solution or additional advice, please share it.

 

Related Posts