2

I'm using Magento2 on Debien 8, and after every change, I lunch the php bin/magento setup:upgrade.

The problem here is when I lunch this command I need to give permission to magento folder using this command on Debien terminal

chmod -R 0777 magento2 (the folder)

is there any solution to fix that ?

  • Run the upgrade using as the www-data user sudo -u www-data php/magento setup:upgrade – MackieeE Mar 25 '19 at 14:43
  • @MackieeE Can't create directory /var/www/html/magento2/generated/code/Magento/Framework/App/ResourceConnection/. Class Magento\Framework\App\ResourceConnection\Proxy generation error: The requested class did not generate properly, because the 'generated' directory permission is read-only. If --- after running the 'bin/magento setup:di:compile' CLI command when the 'generated' directory permission is set to write --- the requested class did not generate properly, then you must add the generated class object to the signature of the related construct method, only. – sayou Mar 25 '19 at 14:46
1

Open following file in terminal

vim /etc/apache2/envvars

check the user for apache

export APACHE_RUN_USER=root
export APACHE_RUN_GROUP=root

Change the user appropritely which your bin/magento commands assign the files you are generating.

The one time change user permission for your magento folder like

sudo chown -R www-data:www-data magento2

Then after it should work.

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.