0

when i execute setup:upgrade command then some file is generated in generated/ folder. after i have execute chmod -R 777 /generated command but when i check in some admin page like : Product grid page then it will showing below error :

Class Magento\Catalog\Model\View\Asset\ImageFactory does not exist

so i need to go into this directory

generated/code/Magento/Catalog/Model/View/Asset

and when i check this folder permission then it will showing 775 so i need to change permission 777 into Asset folder so then it will working fine.

so what is solution to every time update folder permission ? any idea please share.

4 Answers 4

1

Don't give 777 permission as it is not recommended. Try these commands

find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +
find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +
sudo chown -R :<web server group> .
chmod u+x bin/magento

chmod g+w gives write permission to the group owner for those directories. chmod g+ws sets up the group id to the directory where all new files and created in that directory inherit the group id of the parent directory.

So after running the setup:upgrade command, have you run the setup:static-content:deploy command, as running setup upgrade will clean the file system such cache, generated and static files

3
1

You can use 777 (all permission) but it's not secured on server, it's fine with localhost only:

chmod -R 777 generated

When using server you can give permission to specific user group using below commands:

chown -R username:groupname generated

NOTE: Go to magento root directory for using these commands.

0

instead of chmod -R 777 /generated use chmod -R 777 generated

as /generate represent that your generate directory is at your server root directory

0

You can Give All read and write permission to you generated Folder By

chmod +rwx generated

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.