WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. Runamok81
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    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.

    define('WP_TEMP_DIR','/path/to/a/temp/dir');

    That will tell WP where to write the temporary files.

  4. Runamok81
    Member
    Posted 1 year ago #

    Spot on Samuel!
    I added this to my wordpress wp-config.php and the problem is resolved.
    define('WP_TEMP_DIR','C:\Inetpub\wwwroot\wordpress\tmp');

    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. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

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

  6. Runamok81
    Member
    Posted 1 year 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.

    [WebPIChanges]
    error_log=C:\WINDOWS\temp\php53_errors.log
    upload_tmp_dir=C:\WINDOWS\temp
    session.save_path=C:\WINDOWS\temp

    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. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    I put in a ticket for the problem:
    http://core.trac.wordpress.org/ticket/22900

  8. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    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
    Member
    Posted 1 year 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
    define('WP_TEMP_DIR','C:\Inetpub\wwwroot\wordpress\tmp\notarealdirectory');
    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. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    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
    Member
    Posted 1 year 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. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    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
    Member
    Posted 1 year ago #

    php echo shows my temp dir is set to
    C:\Inetpub\wwwroot\wordpress/wp-content/
    for which IUSR has rights.

    How to test?

  14. philip.levine
    Member
    Posted 1 year 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. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    Runamok81: Thanks for the help. We've sort of worked out what the problem is. You can follow the progress on the topic here:
    http://core.trac.wordpress.org/ticket/22900

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

  16. Runamok81
    Member
    Posted 1 year ago #

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

  17. petrich
    Member
    Posted 1 year 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. Samuel Wood (Otto)
    Tech Ninja
    Posted 1 year ago #

    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
    Member
    Posted 1 year 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
    Member
    Posted 1 year 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
    Member
    Posted 1 year ago #

    Ignore this post, I posted something that didnt work

  22. badluck13
    Member
    Posted 1 year ago #

    http://viewoneworld.wordpress.com/2012/12/15/wordpress-3-5-and-windows-serve-plugin-update-install-issue-quick-fi/

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

  23. Sharani
    Member
    Posted 1 year 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.
    define('WP_TEMP_DIR','/path/to/a/temp/dir');

    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