WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Yet another WPMU image problem (24 posts)

  1. djlivi
    Member
    Posted 1 year ago #

    (Apologies for possible cross-post, I also appended a wee question to the end of http://wordpress.org/support/topic/update-wp-342-images-not-displaying-lots-of-posts-read to get details on how another user solved a similar problem)

    Another person here with issues after updating to 3.4.2
    Images have dissapeared from media libraries and uploaded headers do not display.
    See e.g. http://unversity.org/
    The image that should be shown can still be accessed via a url using the ftp path from /wp-content/, e.g.:
    http://unversity.org/wp-content/blogs.dir/5/files/2012/09/IMAG1062-1024x613.jpg

    This seems similar to the problem encountered by chaos1 here, but I don't have any extra .htaccess files - only the standard wpmu one same as:

    # BEGIN WordPress
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]
    
    RewriteCond %{REQUEST_FILENAME} -f [OR]
    RewriteCond %{REQUEST_FILENAME} -d
    RewriteRule ^ - [L]
    RewriteRule . index.php [L]
    # END WordPress

    Ive tried a few of the other common fix suggestions:
    - changing permissions on blog.dir folders to 777, 755 etc
    - switch to 2011 theme, disable plugins

    Help or suggestions appreciated!

  2. The image that should be shown can still be accessed via a url using the ftp path from /wp-content/, e.g.:
    http://unversity.org/wp-content/blogs.dir/5/files/2012/09/IMAG1062-1024x613.jpg

    Okay, the image SHOULD be accessed at http://unversity.org/wp-content/files/2012/09/IMAG1062-1024x613.jpg

    What do you see there?

  3. djlivi
    Member
    Posted 1 year ago #

    That link gives a page not found error.
    Within webpages on the blog, URLs for images are created with the pattern /files/2012/06/UNversity-Banner1.jpg (i.e. without the wp-content/ - and those links lead directly to a to broken image icon, rather than the page not found error.

    I'm confirming that mod_rewrite is still enabled on the server, but as this was working until very recently I think it has to have been a 3.4.2 update issue.

  4. djlivi
    Member
    Posted 1 year ago #

    Also just discovered that the [content] and [archives] shortcodes that I use on one of my blogs dont appear to work now either. Not sure if this is in any way related.

  5. djlivi
    Member
    Posted 1 year ago #

    Well, it isn't a problem with mod-rewrite. So back to having no idea what has happened (or isn't happening that should be)

    I also checked for rogue .htaccess files, but there is indeed only the one, with the wordpress rules shown above.

    Still wondering if anyone can help with this one!

  6. djlivi
    Member
    Posted 1 year ago #

    ps Im using the wordpress MU domain mapping plugin:
    http://wordpress.org/extend/plugins/wordpress-mu-domain-mapping/

    Not sure whether this is a likely/possible issue - but everything worked until very recently.

  7. djlivi
    Member
    Posted 1 year ago #

    Just tried the following standard steps again:
    - deactivating all plugins to see if this resolves the problem. It didn't.
    - switching to the Twenty Eleven theme to rule out any theme-specific problems. Already on this theme
    - resetting the plugins folder by FTP or PhpMyAdmin. Sometimes, an apparently inactive plugin can still cause problems. Didn't help
    - re-uploading all files & folders - except the wp-content folder - from a fresh download of WordPress. No change at all.

    To confirm, I can still upload images, and they are placed in the correct blogs.dir subfolder. But the URLs that WordPress is generating to access those images are not resolving correctly. My Media Library on all blogs shows only broken images, and all use of uploaded images (as headers or in posts) is now broken.

    Although this problem persists with plugins off, I am wondering if there is any connection with domain mapping.

  8. If you mapped the domain and manually edited the site details, that would be why.

    Look at the beginning of the URL - is it the mapped domain or the original blog address?

    Do the sub blogs work when they are not mapped?

  9. djlivi
    Member
    Posted 1 year ago #

    The first time I ever tried to manually edit site details was when trying to fix this :-)
    Media works on the 'master' blog (which I don't actually use, so I hadn't tested it up till now) - but that simply uses the /wp-content/uploads folder without re-writes.

    Switching off mapping on sub-domains doesn't seem to help though:
    http://unversitydotorg.virtualba.co.uk/files/2012/06/UNversity-Banner2.jpg
    still doesnt work.

    http://unversitydotorg.virtualba.co.uk/wp-content/blogs.dir/5/files/2012/06/UNversity-Banner2.jpg *does* work though.

    Completely lost here :-(

  10. djlivi
    Member
    Posted 1 year ago #

    ps I thought that at least changine the file upload URL in settings to http://unversitydotorg.virtualba.co.uk/wp-content/blogs.dir/5/files would fix this, but it doesn't actually seem to have any effect at all (unless the page is being cached somewhere between me and the server)

  11. Switching off mapping on sub-domains doesn't seem to help though:
    http://unversitydotorg.virtualba.co.uk/files/2012/06/UNversity-Banner2.jpg
    still doesnt work.

    http://unversitydotorg.virtualba.co.uk/wp-content/blogs.dir/5/files/2012/06/UNversity-Banner2.jpg *does* work though.

    Then check your htaccess rules, as that is what controls the switching.

  12. djlivi
    Member
    Posted 1 year ago #

    .htaccess is as listed at the top of this thread. .htaccess is definately working and enabled, as I can create my own arbitrary rewrite rules and test them. And is the only .htaccess file on my server.

    I recopied the rules from the setup page within WPMU itself just incase there was a typo there that I couldn't spot.

    Wondering if perhaps there are some settings/values being used by the scripts that do the final part of the mapping in wp-includes/ms-files.php that might be messing up.

    Though Im thinking now of taking the extreme measure of just putting all my blogs into maintenance mode until 3.5 is out. :-(

  13. Next step is 'Check your httpd.conf and make sure AllowOverride is set to ALL'

  14. djlivi
    Member
    Posted 1 year ago #

    Update on where I'm at...
    AllowOverride All is set.
    I put some echo statements and a die at the head of wp-includes/ms-files.php.
    This was enough to verify that http://unversitydotorg.virtualba.co.uk/files/2012/06/UNversity-Banner2.jpg

    is re-written to:
    http://unversitydotorg.virtualba.co.uk/wp-includes/ms-files.php?file=2012/06/UNversity-Banner2.jpg

    Now going to try to work out why this isn't serving the correct file...

  15. djlivi
    Member
    Posted 1 year ago #

    ... and the correct file name with the full path is being passed to the readfile() command at the end of the script. The correct filesize is being added to the header.
    If I try to force download in the script, it downloads a file of size 0 though.
    Have to admit that this is as likely some weird server error as it is a wordpress one, but no idea what that might be :-(

  16. djlivi
    Member
    Posted 1 year ago #

    Readfile is silently failing. Which is something Im at a loss to think how to fix.

    For info,
    I commented out the central part of the body of ms-files.php - everything after it determines the full path name.
    At the end I added the following:

    echo "<br />Made it to the end of ms-files.php. <br /> File is: " . $file;
     echo "<br /> is size " . filesize( $file );
     if (file_exists($file))
       echo "<br /> file exists.";
     else
       echo "<br /> file not found.";
     if (!readfile($file))
       echo "<br /> readfile failed.";
     else
       echo "<br /> readfile succeeded.";
     echo "<br /> readfile returned filesize = " . readfile($file);

    And the result I get when visiting a media file is:

    Made it to the end of ms-files.php.
    File is: /home/virtual/public_html/wp-content/blogs.dir/5/files/2012/06/UNversity-Banner2.jpg
    is size 37334
    file exists.
    readfile failed.
    readfile returned filesize =

  17. What version of PHP are you using?

  18. djlivi
    Member
    Posted 1 year ago #

    5.3.18

    Just looking at build date listed on Phpinfo - which gives Nov 5th, so it could have been a php update that broke my images? (This is on a shared virtual server, so I would have expected other users to be affected)

  19. It's possible (and if no one else is using Multisite, they may never notice). That's a safe version of PHP to use, however.

    How big are these images?

  20. djlivi
    Member
    Posted 1 year ago #

    Images vary a lot in size - includes trimmed headers and uploaded images. Header images might be 30k to 60k as jpg or png.

    Will do some more php tests to see if readfile works under any circumstances, if not then at least that'll be problem...

  21. djlivi
    Member
    Posted 1 year ago #

    Think I've found it, in an unexpected place - looks like php readfile() was disable for security purposes when php was last updated on the server.
    As you say, I might have been the only person using it...

    Have put in support ticket with my host, will let you know if this sorts it out...

    thanks again for all your help and suggestions!

  22. Let us know how it goes!

    The readfile() isn't a feature used by everyone, but it's a 'standard' PHP setting (which is to say, I didn't know anyone turned it -off-)

  23. djlivi
    Member
    Posted 1 year ago #

    Now have readfile working on the blog... and I now have some images back. On some blogs, all images are back - on the blog I've been linking to only some images are back.
    I reckon that in all the previous attempts to fix things that weren't broken, I must have broke something! Still, I'm hoping that I'll be able to manage from here...

    Thanks again to all

  24. djlivi
    Member
    Posted 1 year ago #

    And to confirm: I had to reload some images that somehow got broken links along the way, but all is working now.

Topic Closed

This topic has been closed to new replies.

About this Topic