1

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

  • what did you mean – prabhakaran7 Nov 29 '18 at 5:00
  • on console you are getting 404 thair is i think no issue of permistion is your admin panel is same as fronend? like css not aplied.... – Adarsh Shukla Nov 29 '18 at 10:39
  • how to i solve this – prabhakaran7 Nov 29 '18 at 10:54
  • admin panel also prints like this – prabhakaran7 Nov 29 '18 at 11:11
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
  • You have to be root to change the owner of files/directories. sudo chown -R www-data /var/www/html/magento/ – Ashish Viradiya Nov 29 '18 at 5:42
  • 1
    can i run using sudo – prabhakaran7 Nov 29 '18 at 5:44
  • Yes run using sudo. – Ashish Viradiya Nov 29 '18 at 5:44
  • sudo adduser {username} www-data - which user i can add root or user1 – prabhakaran7 Nov 29 '18 at 5:47
  • Your current user. – Ashish Viradiya Nov 29 '18 at 5:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.