2

i have some trouble when i run command php bin\magento setup:static-content:deploy

it always keep missing permission when create new folder even after i assign full permission (i'm using windows) and tick 'apply to subfolder and files', this permission is not inherited in new folder

is this some bug on magento and is there any way to fix this?

PS: my magento is on dev server which is running CentOs and my local computer is running windows 7

  • use sudo php bin\magento setup:static-content:deploy – inrsaurabh Dec 22 '17 at 7:03
  • @SaurabhRanjan since i use windows in my local, so i need to run cmd in administrator – Sandy Dec 22 '17 at 7:10
  • I am not sure you could run Magento2 in a proper way in a Windows machine – Raul Sanchez Dec 22 '17 at 10:38
2

Magento 2 recommended folder and file permission

Please follow following terminal commands for folder and file permission.

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

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

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

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

chmod u+x bin/magento
| improve this answer | |
  • This doesn't apply to windows – Dominic Xigen Jun 19 '19 at 23:00
1

Whenever i run into issues on a dev server i found the best way would to fix is to first find out which user and group Magento is running under, navigate to another folder (not one with permission issues) and do :

ls -la

Check the columns for user and group on the correct files and then fix the permission on the problem folder by applying those same ownership with

chown -R username:groupname ./*

The other thing that may be a problem is who you are logged in as when you run bin/magento as this users permission will be transferred to the created folder, Its best to switch to the user Magento is running under if you can first. Also never run chmod 777 if you can help it as it assigns global permissions to the files

| improve this answer | |
0

I'm a windows user

I gave up trying to run magento natively for dev mainly due to permissions and symlinks

I switched to using docker

https://github.com/meanbee/docker-magento2

Although docker within windows is a bit slow

I now run ubuntu minimal through hyper v which is running docker

Sounds crazy but it's fast and about as close to live environments as I can get. Plus being in docker I can stop and start different full stacks in minutes.

| improve this answer | |
-1

Set permission by using below command, it will set recursively permission

chmod -Rf 755 pub;chmod -Rf 755 var;
| improve this answer | |
-1

try this

chmod -R 777 pub/static 
| improve this answer | |
  • Hi, i have tried to set chmod 777 but still have some folders not have the permission. should i run this on my server directly and use root to run the command ? – Sandy Dec 28 '17 at 6:42
  • sudo chmod -R 777 pub/static – Ravindrasinh Zala Dec 28 '17 at 6:48

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.