0

I know this has been asked a million times, but I can't find the right answer.

I have a Magento 1.9 on a shared server. Images keeps failing to show. I can change the folder permissions through FileZilla and the images shows up, but in the next product it is wrong again. I can see that Magento is creating new folders with the permiision 750 and images with 640.

Can I change it somewhere so the permissions is right?

2

the preferred permission to be given to a folder and file structure in Magento should be

755 to all folders
644 to all files

don't forget to use recursively to sub directories and files in them.

find /var/www/directory/folder/ -type d -exec chmod 755 {} +
find /var/www/directory/folder/ -type f -exec chmod 644 {} +
  • That works, but when I go to the next product and Magento is creating a new folder inside the cache folder. The permission is wrong and the image is not shown. There must be somewhere I can tell Magento what the permission should be by default. – Jeppe Donslund Oct 17 '18 at 13:32
  • you need to use sudo, before running these commands. and it will solve the purpose. But watch out to the use of sudo everytime. – John Oct 17 '18 at 13:34
  • sudo find /var/www/directory/folder/ -type d -exec chmod 755 {} + – John Oct 17 '18 at 13:35
  • Won't this only work for created folders and files? When Magento creates a new subfolder inside the cache folder, files in that folder is not working. It is the permission on new folders that is wrong. – Jeppe Donslund Oct 18 '18 at 12:08
  • that's why i have mentioned to use sudo, so it will do is that, whenever a new folder was created inside existing, it will transfer the same permission to new one, because 1. we are using sudo 2. we are using -R recursively. – John Oct 18 '18 at 12:27
0

Do it via ssh, command to run: chmod 755 -R /var/www/yourMagentoProject/media

-R for a recursive.

If you just want products images: chmod 755 -R /var/www/yourMagentoProject/media/catalog

  • Will that also work for new folders created by Magento? – Jeppe Donslund Oct 18 '18 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.