2

enter image description here

Hi i am using Ubuntu 18 and apache2

when i setup magento 2 on localhost

always have file permission problems and also

whenever i run

sudo php bin/magento setup:di:compile 

it will cancel all file permission

already tried comment

sudo chmod -R 777 var/www/html/myproject/*

My Question: 1)How give proper file and directory permission to my magento project

Sukumar Gorai
  • 10,823
  • 4
  • 19
  • 46
prabhakaran7
  • 1,077
  • 1
  • 16
  • 58

1 Answers1

0

As per recommendations of Magento, the folder and file permission for Magento 2 installation should be like:

cd <your Magento install dir>

find . -type f -exec chmod 644 {} \; // 644 permission for files

find . -type d -exec chmod 755 {} \; // 755 permission for directory

find ./var -type d -exec chmod 777 {} \; // 777 permission for var folder

find ./pub/media -type d -exec chmod 777 {} \;

find ./pub/static -type d -exec chmod 777 {} \;

chmod 777 ./app/etc

chmod 644 ./app/etc/*.xml

chown -R : .

chmod u+x bin/magento

Also, add the user to the www-data group with...

sudo adduser {username} www-data
Ashish Viradiya
  • 1,562
  • 2
  • 18
  • 39