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/

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.

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

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

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 {} +

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.

  • @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 Jul 10 at 13:37
  • pls tell about 'Magento user' and 'web server group', I think this is the problem – Ajwad Syed Jul 10 at 13:48
  • Can you please run ll command and display the output here in terminal – Raj Mohan R Jul 10 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 Jul 10 at 14:07
  • I am asking you to Check the ownership of magento directory and files using ll command – Raj Mohan R Jul 10 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/*
  • Same, no effect – Ajwad Syed Jul 10 at 13:42
  • generated is your project name ? – Shafeel Sha Jul 10 at 13:56
  • no, it is folder for generation – Ajwad Syed Jul 10 at 14:00
  • sudo chmod -R 777 /var/www/html/{your_project_folder}/generated/ try this – Shafeel Sha Jul 10 at 14:02
  • but generated folder is at var/www/html/generated.. – Ajwad Syed Jul 10 at 14:09

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.