Tutorial: Fix the "Download failed. Destination directory for file streaming does not exist or is not writable." Error in WordPress
Print
  • Download failed, WordPress
  • 259

Tutorial: Fix the "Download failed. Destination directory for file streaming does not exist or is not writable." Error in WordPress

Introduction

When trying to install a plugin in a fresh WordPress installation, you may encounter the following error:

Download failed. Destination directory for file streaming does not exist or is not writable.

This error is typically caused by incorrect permissions in the wp-content folder, as WordPress needs to create a temporary folder to place files when they are downloaded before installation.

Cause of the Error

  • Incorrect permissions on the wp-content folder.

  • Missing temporary folder for downloaded files before installation.

Instead of using 777 permissions on the wp-content folder, which poses a security risk, we will place the temporary folder outside of the installation directory in a safe location.

Steps to Fix the Error

1. Access Your Server

Log in to your server where WordPress is hosted. If you're using shared hosting or a VPS, connect using FTP or SSH.

2. Create the Temporary Folder

Inside the root of your WordPress installation, but outside of the public directory (typically public_html or www), create a folder named temp.

  • If you are using a terminal (SSH), go to the root of your WordPress installation, then go up one level to the parent directory:

cd /path/to/your/wordpress/installation/
mkdir temp
chmod 777 temp

This will create the temp folder and set the permissions to 777, allowing WordPress to use it as a temporary folder.

3. Edit the wp-config.php File

Now, open the wp-config.php file located in the root of your WordPress installation. You can do this with a text editor or via the terminal:

nano /path/to/your/wordpress/installation/wp-config.php

Add the following line at the end of the file:

define('WP_TEMP_DIR', ABSPATH . '/../temp/');

This line tells WordPress to use the temp folder we just created as its temporary directory for downloaded files.

4. Verify the Solution

Once you've saved the changes, try installing or updating a plugin in WordPress again. The error should be resolved, and you should be able to install or update plugins without issues.

5. Additional Considerations

  • The temp folder should be located outside the public directory to avoid potential security risks.

  • Remember that 777 permissions should only be used on this type of temporary folder and not on critical folders like wp-content or wp-config.php.


By following these steps, you will have fixed the "Download failed. Destination directory for file streaming does not exist or is not writable." error in your WordPress installation. Using a temporary folder outside the public directory will not only resolve the issue but also prevent creating security vulnerabilities on your site.

If you need further assistance, feel free to ask. Good luck with managing your WordPress site!

Was this answer helpful?

Related Articles