Fix Magento Missing Images In Checkout Cart

When moving a magento instance to a new server, it seems the product cache exhibits some very strange behavior making a fix to the new server almost impossible after the fact. Everything seems fine except there are missing product images in the checkout / cart area for example. You check the /product/cache/ and find the images are actually there. You can refresh the cache all day long. Still the images are missing.

The problem seems to be an imprecise backup and transfer process. This seems to be a result of a mismatch between the database and some files (cache). That means the time in between backing up the database and the transfer of files to the new server are not simultaneously completed and therefore small differences exist.

The Solution

Because permissions can be a problem, use

  • Rsync to transfer the entire site between the servers with -avz to preserve permissions. DO NOT BACKUP OR COPY to another remote (such as your desktop).
  • Make sure to run CHOWN on the entire original site so that Rsync is able to transfer every file.

Because differences between database backup and cache can occur (because they cannot be completely simultaneously),

  • shut down apache during the backup and transfer process so nothing changes in the interim

Some other suggestions

  • Rename ../media/.htaccess to HTACCESS (just a backup)
  • Rename ../media/catalog/product/cache to _cache (just a backup)
sudo vi /etc/php5/apache2/php.ini
  • increase memory to 256MB
  • Add [suhosin] suhosin.simulation = On
sudo apt-get install php5-gd

You may also like...