[resolved] Plugin upgrades fail after update to WP 3.5 (23 posts)

  1. Runamok81
    Posted 3 years ago #

    I recently upgraded to WP 3.5 on IIS6.
    Now, upgrading or downloading plugins no longer works.
    Download failed. Destination directory for file streaming does not exist or is not writable.

  2. Runamok81
    Posted 3 years ago #

    The error seems to indicate a permissions issue, but I haven't changed permissions. I can upload and activate plugins manually.

    I have disabled all plugins, and retried. no luck.
    I have switched themes, and retried. no luck.
    No messages from debug mode.
    No related errors in php53_errors.log

    For now, I am stopping just short of redeploying 3.5 from a fresh download.

  3. When WordPress downloads a plugin ZIP file, then it has to be able to write that file somewhere. To do this, it uses the "temp" directory.

    If WP detects that it cannot write files to this temp directory, then you get the error message you are now getting. WP tries to find a valid temp directory, but sometimes servers are configured poorly.

    You can work around this by specifying a temp directory on your server with a place that you know WordPress is allowed to write files to. You can do this by adding this line of code into the wp-config.php file.


    That will tell WP where to write the temporary files.

  4. Runamok81
    Posted 3 years ago #

    Spot on Samuel!
    I added this to my wordpress wp-config.php and the problem is resolved.

    Now, to figure out what is causing PHP to think it can't use the same temp directory it was in 3.4? Perhaps this dev ticket will shed some light?

  5. Probably. If the host is configured to have a system defined temp directory that isn't actually writable, then, well, that sucks.

  6. Runamok81
    Posted 3 years ago #

    Yes, the host configuration was performed by Microsoft Web Platform Installer 4.0 on IIS6 (ya, I know) WebPI 4.0 sets the host temp directory by adding these lines to the php.ini out-of-the-box.


    Might want to warn others using the WebPi. They are either going to have to redefine their temp directory via wp-config.php, php.ini, or give IUSR right to the Windows temp directory (yikes!)

    Thanks for help. I will mark resolved later this evening.

  7. I put in a ticket for the problem:

  8. Hey, since you have the system with the problem, if you want to test something for me, that might help.

    Instead of doing the WP_TEMP_DIR workaround, try this:

    In /wp-includes/class-http.php, you'll find this code around line 145:

    if ( ! is_writable( dirname( $r['filename'] ) ) )
    	return new WP_Error( 'http_request_failed', __( 'Destination directory for file streaming does not exist or is not writable.' ) );

    Try simply removing or commenting out those two lines. Only those two lines, mind you. Then see if the process works without that error and without the WP_TEMP_DIR workaround.

    I'm thinking that maybe the process actually can write to the temp directory, but just thinks it can't. I dunno. I might be wrong.

  9. Runamok81
    Posted 3 years ago #

    I wasn't sure how to unset the WP_TEMP_DIR. Removing the entry didn't seem to unset it. So I redefined it as
    This re-introduced the error.
    Then I commented out lines 144 and 145 of class-http.php
    This yielded a different error.

    Download failed. Could not open handle for fopen() to C:\Inetpub\wwwroot\wordpress\tmp\notarealdirectory/bcd-upcoming-posts.tmp

    I am back in a working state by reinstating rights to and redefining my new WP_TEMP_DIR.

  10. Just removing the entry will work and unset it (it's not saved anywhere). You may need to restart the webserver if it caches PHP opcodes.

    Setting it to something invalid just will cause it to fail in a different and somewhat meaningless way.

    That setting is a forced override, as long as it is there, you can't test properly.

  11. Runamok81
    Posted 3 years ago #

    I have removed the WP_TEMP_DIR entry. Tested both ways. With and without 144 and 145 commented out... plugin installs work both ways.

    How can I verify where my WP_TEMP_DIR is actually set?

  12. There is no easy way to verify it, but if you have a test setup, then you can add something like echo get_temp_dir(); to your theme to see what WordPress is using as the temp dir.

    Also, thanks for checking this for me! That helps a lot. :)

  13. Runamok81
    Posted 3 years ago #

    php echo shows my temp dir is set to
    for which IUSR has rights.

    How to test?

  14. philip.levine
    Posted 3 years ago #

    Just to add to this...i'm on a windows box with IIS 7.5 and PHP 5.3.6

    Regardless of what I set the php upload_tmp_dir to
    get_temp_dir() replys with C:\Windows\TEMP/

    (even after restarting IIS)

  15. Runamok81: Thanks for the help. We've sort of worked out what the problem is. You can follow the progress on the topic here:

    A fix will likely be in 3.5.1. The WP_TEMP_DIR workaround will work for now though.

  16. Runamok81
    Posted 3 years ago #

    Thanks for the quick fix for my server. I'll move to 22900 to follow progress.

  17. petrich
    Posted 3 years ago #

    Hi guys

    First a special "thanks" to Samuel for your advice and workaround

    As I am the admin of the Web Server IIS, I check in my php.ini and with an echo get_temp_dir(); whic directory was used by WP before adding the workaround line inwp-config.

    So I tried to add Full control permission to my App pool identity over this directory (the one in php.ini) and indeed, it works well ;-)

    Do you see any danger in working around the way I just explained instead of addingline to wp-config.php ?

    Thank you ...

  18. petrich: That's probably not the safest thing in the world to do.

    The workaround we're recommending for now is to add this to your wp-config.php file:

    define( 'WP_TEMP_DIR' , ABSPATH . 'wp-content/' );

    That has the affect of making WP try to use the wp-content directory as the temp directory, which tends to work a lot more often on IIS servers.

  19. petrich
    Posted 3 years ago #

    Yep right,

    I actually a little while later the workaround about adding line with the ABSPATH . 'wp-content/' in wp-config.php. I like it better than creating a temp directory and explicitly declare it in wp-config.php

    So i changed my mind and finally followed this suggestion of workaround instead of my suggestion.

    Have a nice week end guys,

  20. tbittan
    Posted 3 years ago #

    I'm having the same issue, I echo WP_TEMP_DIR and it's 'C:\Inetpub\wwwroot\wordpress/wp-content/'

    I still get the 'Download failed. Destination directory for file streaming does not exist or is not writable.' error.

    When I try to install a plug in I also get prompted for ftp details, which I don't understand at all.

  21. Richard
    Posted 3 years ago #

    Ignore this post, I posted something that didnt work

  22. badluck13
    Posted 3 years ago #


    here you need to do 2 steps described on this post and its going to work :)

  23. Sharani
    Posted 3 years ago #

    Our site runs on a Windows Server and gave this error message when I had 2 plugins that wanted upgrading today after upgrading to WordPress 3.5 a couple of days ago. To get the 2 plugins to upgrade successfully, I first tried putting this code mentioned in this thread and it did not work.

    Then I tried this code mentioned in this thread and it did work.
    define( 'WP_TEMP_DIR' , ABSPATH . 'wp-content/' );

Topic Closed

This topic has been closed to new replies.

About this Topic