We ran into a Magento issue where product images would not appear on the product information page after moving a site to another Magento instance.

At first the problem looked much more complicated than it really was, but the actual cause turned out to be simple: a permissions issue in the media cache directory.

What happened

In our case, we copied the media directory from one Magento instance to another using cp -r. The source site had already been running for a while, so its media structure included a cache directory created by Magento for resized and reused images.

After the copy, the target environment could no longer write into that cache directory properly. As a result, Magento could not generate or reuse the product image cache, so the images stopped appearing.

Quick fix

We fixed it by resetting ownership and making sure the cache directory was writable by the web server and PHP process.

1
2
chown -R user:www-data cache/
chmod -R 777 cache/

You can tighten the permissions later if needed, for example to 775 or 755, once you confirm the right owner and group are in place.

That was enough to solve what had turned into a long and frustrating troubleshooting session.