Forums

[resolved] Random Images Don't Load (4 posts)

  1. jprovost
    Member
    Posted 4 months ago #

    Some images on my sites (WPMU) fail to load, showing question marks or X depending on browser. Viewing the images directly via their URL works. Refreshing the page again loads random images, breaking some that worked, loading others that didn't.

    Error Console in Safari shows a 500 Internal Server Error. The server error log shows (for example):
    [Thu Jan 12 11:15:03 2012] [error] [client 24.150.211.28] (12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/jprovost/public_html/wp-includes/ms-files.php, referer: http://jamesprovost.com/infographics/
    [Thu Jan 12 11:15:02 2012] [error] [client 24.150.211.28] (12)Cannot allocate memory: couldn't create child process: /opt/suphp/sbin/suphp for /home/jprovost/public_html/index.php, referer: http://jamesprovost.com/infographics/

    I contacted my host and they said nothing is wrong on their end, and that it looks like a permissions issue.

    I have since installed WP Super Cache to hopefully alleviate the memory allocation errors.

    I recently transferred some domains from godaddy to namecheap, but I don't think that's the issue because one domain didn't change registrars but is affected.

    Any ideas?

  2. jprovost
    Member
    Posted 4 months ago #

    Update: It seems that ms-files.php was hanging, delivering incomplete file headers, and using up all of my shared hosting resources.

    The following .htaccess rules resolved my problem. They seem to bypass ms-files.php completely, instead redirecting requests from domain.tld/files/ to domain.tld/wp-content/blogs.dir/#/files/

    RewriteCond %{HTTP_HOST} ^domain\.tld$ [NC]
    RewriteRule ^files/(.+) wp-content/blogs.dir/#/files/$1 [L]

    Be sure to replace domain.tld AND the # with the blog id number.

  3. jprovost
    Member
    Posted 2 months ago #

    For the benefit of anyone who finds their way here, this is what my .htaccess at /www/ looks like:

    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    
    # uploaded files
    # RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2&path=$1 [L]
    
    #domain1
    RewriteCond %{HTTP_HOST} ^domain1.com\.com$ [NC]
    RewriteRule ^files/(.+) wp-content/blogs.dir/1/files/$1 [L]
    
    #domain2
    RewriteCond %{HTTP_HOST} ^domain2\.org$ [NC]
    RewriteRule ^files/(.+) wp-content/blogs.dir/5/files/$1 [L]
    
    #domain3
    RewriteCond %{HTTP_HOST} ^domain3\.ca$ [NC]
    RewriteRule ^files/(.+) wp-content/blogs.dir/8/files/$1 [L]
    
    #domain4
    RewriteCond %{HTTP_HOST} ^domain4\.com$ [NC]
    RewriteRule ^files/(.+) wp-content/blogs.dir/14/files/$1 [L]
    
    #...the rest of the rename rules follow this.

    Supercache also greatly reduced my server memory and CPU usage.

  4. jprovost
    Member
    Posted 1 month ago #

    Further to all this, I've since reinstalled WordPress to try and address another problem and it has solved this one. The new .htaccess is working fine so far.

Reply

You must log in to post.

About this Topic