0

I am upgrading Magento 2, and all Readiness checks are passed after giving 777 permission to pub/meda, generated folder. But during upgrade process it stops throwing error of non-writeable folder for the same folders that I provided them permissions before upgrade starts. Infact, readiness check is not passed without these permissions. Then again I provide permissions and after some time it requires again permissions.

Can we give the permissions once until the upgrade process gets complete..

I am upgrading on local server. Using Docker Image for community edition and upgrading for enterprise edition.

Here is the command that I use for writeable conditions exactly:

chmod -R 777 /var/www/html/generated/

1
  • I'm installing Magento2 setup on Cplace server, DB imported from dump and codes are copyed from the server. But still, I'm getting this error on the browser. > Fatal error: Uncaught Zend_Cache_Exception: cache_dir > "/home/walsoul4/m2.walsoulconsulting.com/var/cache/" is not writable > in > /home/walsoul4/m2.walsoulconsulting.com/vendor/magento/zendframework1/library/Zend/Cache.php:209 > Stack trace: #0 > /home/walsoul4/m2.walsoulconsulting.com/vendor/magento/zendframework1/library/Zend/Cache/Backend/File.php(180): > Zend_Cache::throwException('cache_dir "/hom...') #1 > /home/walsoul4/m2.walso Commented Feb 22, 2021 at 11:06

2 Answers 2

0

Please run these commands and check

Execute these commands as a root user. If you have already given 777 permission revert it using the first two commands else proceed with the rest.

sudo find . -type f -exec chmod 664 {} \;

sudo find . -type d -exec chmod 775 {} \;

sudo find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} +

sudo find var generated vendor pub/static pub/media app/etc -type d -exec chmod g+ws {} +

Set the ownership to Magento user and web user using

sudo chown -R <Magento user>:<web server group> .

Running these commands sets the permission for folders and files in Magento root and for the new files to be created in var, pub, and generated directories.

Don't run any command as root user as it might cause the new static files to be created with root ownership which might prevent web user to access such files forcing you to provide 777 permission. Please, in any case, don't give 777 permission if so please revert it back. So run Magento commands as Magento user.

8
  • @Mohan, what is Magento user, in my case I execute all commands at var/www/html this is where magento folder exit like vendor, app etc
    – Ajwad Syed
    Commented Jul 10, 2019 at 13:37
  • pls tell about 'Magento user' and 'web server group', I think this is the problem
    – Ajwad Syed
    Commented Jul 10, 2019 at 13:48
  • Can you please run ll command and display the output here in terminal Commented Jul 10, 2019 at 13:49
  • Uncaught Zend_Cache_Exception: cache_dir "/var/www/html/var/cache/" is not writable in /var/www/html/vendor/magento/zendframework1/library/Zend/Cache.php:209 Stack trace:
    – Ajwad Syed
    Commented Jul 10, 2019 at 14:07
  • I am asking you to Check the ownership of magento directory and files using ll command Commented Jul 10, 2019 at 14:08
0

try this commands and this will help you to allow permission to your project folders

sudo chmod -R 777 pub/* var/* generated/*
4
  • Same, no effect
    – Ajwad Syed
    Commented Jul 10, 2019 at 13:42
  • no, it is folder for generation
    – Ajwad Syed
    Commented Jul 10, 2019 at 14:00
  • sudo chmod -R 777 /var/www/html/{your_project_folder}/generated/ try this Commented Jul 10, 2019 at 14:02
  • but generated folder is at var/www/html/generated..
    – Ajwad Syed
    Commented Jul 10, 2019 at 14:09

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.