Images Disppear after Flushing Image Storage Cache in Magento

Over the weekend we moved our website to a new server. We had our hosting provider do the migration over the weekend to minimise any disruptions and it all went fairly well.

The copy of the website was exactly the same as it was on the older server, which was all according to plan. We switched the name servers and the website was up and running. So far so good.

In our testing we found a few images here and there to be missing, so normally the thing to do is to flush the cache and reindex. That is when things started to turn for the worse!

After we flushed the image storage cache, we took a look at the site and all of the products had disappeared from the main page and as listings on the category pages. All we could see was the header, sidebar, breadcrumbs and pager. The rest of the page was empty and the footer was gone. We could still browse the product by the URL, which showed up everything as it should minus the image.

We spent hours disabling the cache, reindexing the data, making sure every folder has been migrated from the older server, checking that the images were still linked in each product. We Googled the issue and a potential solution was to disable all the products and then re-enable them, that didn’t work. I added a few new products with new images, that wasn’t showing any images either.

Tearing my hair out by this stage I pointing the nameservers back to the old server and once it replicated it was back to normal, although we still had a broken copy of the newer, faster, better server.

I decided to SSH into both servers and check the folder permissions. While in the \media\catalog\product directory I noticed that the older server had a \cache\ folder inside it and the new server didn’t. I thought this was a bit odd as the copy of the website on the new server should be exactly the same as the older one, and the only change we had made was that we flushed the image storage cache.

Another thing we noticed was when we compared the permissions between the two servers was that the older server was owned by a user “foodo” and group “nobody” whereas the new server was “foodo” and “foodo”.

By this stage it was fairly clear what the issue was – permissions. It turned out that when you “flush” the image storage cache it deletes the \cache\ folder inside \media\catalog\product\ . The next time the site is loaded it should start to regenerate the cache folder. Due to the permissions issue Magento could not recreate this folder, therefore the images were not being found by the front end and the page stopped loading, which is why the products were missing as well as the footer.

What I still don’t understand is even though we turned off all caching, we could still not see the product thumbs and main images.

Once we applied the permission changes (changed group to “nobody”), I pointed the name servers back to the new server. We flushed the cache again, reloaded the site and everything was back to normal.  I also renamed the \cache\ directory to \cache1\ to make sure after we refreshed the site again, it recreated the directory.

It was a fairly stressful 24 hours, and as per usual asking questions on the Magento forums did nothing. Every time I have had an issue and posted on the forums, it has never been replied to.

Magento is such a great platform, though it is very bugging and the support isn’t that great. The community tries, but it is no WordPress. Whenever I recommend someone use Magento for their e-commerce needs I warn them to be prepared to rip their hair out at least 2-3 times a year.  That is number 1 for

Tags : , , ,

If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.


Leave Comment