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 Answers 2

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 {} +
7
  • 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. Oct 17, 2018 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.
    – Akash
    Oct 17, 2018 at 13:34
  • sudo find /var/www/directory/folder/ -type d -exec chmod 755 {} +
    – Akash
    Oct 17, 2018 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. Oct 18, 2018 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.
    – Akash
    Oct 18, 2018 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

1
  • Will that also work for new folders created by Magento? Oct 18, 2018 at 6:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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