Late yesterday, we’re working on something we don’t expect in magento. Looking into the problem is very frustrating because we really don’t have any clue what just happened until we found out that its just a persmission problem.
This might occur to you when you want to move a magento site to other existing instance (site) of magento. If you’ve been to magento, you know this already. In our case, we manually copied the media folder under the root directory of magento to the target instance of magento. Now, the previous media dir has “cache” folder already since it has been running for a long time now.
This cache folder is created on-the-fly when we tried to visit product information so that when you get back, it will reuse the same pictures together with your active session in the server-side.
Now, what just happened when we transferred the pictures in the target instance using “cp -r” in linux is that it resets the permissions of the folder. So eventually, the web-server and php can’t right in it.
So our quick solution is we chowned the folder to its same user of the target folder. in the example it is “user” and a group “www-data”. We also chowned the folder to 777 since its not that visible to public and for us to really make sure it is writable for any users.
> chown -R user:www-data cache/ > chmod -R 777 cache/
Anytime you can adjust the permissions like change to 775 or 755. And for this problem, it works and it solved our 24 horurs problem.