I keep having to enter permission commands every time a i do a grunt clean and exec. I'm constantly getting a white page with errors, either Class doesn't exist, can't create directory or permission denied.

Anyone got any ideas what i might be doing wrong?

  • Are you use grunt for compilation ? – Suresh Chikani Jul 28 '16 at 17:34

You are most likely running into issues because you are uploading or processing things as a different user from the one Apache (or nginx/php) runs as. PHP can't write those files because of the differing user and file permissions, and so you get the errors.

If you're doing anything as root, fix that first. Don't.

Otherwise, you might try putting your user and the Apache user in the same group, and setting that group on all Magento files and directories.

See here for recommended permissions setup in Magento 2.x:

if running as root:

su USER -s /bin/bash -c "MAGENTO COMMAND"

to change the owner:

chown -R user:user *
  • Thats great thanks! How do I set up a new user? – Mark Jul 29 '16 at 8:22
  • Sorry being stupid but wht goes in "Magento command"? – Mark Jul 29 '16 at 9:48

Could you provide step by step instructions on how to resolve this?

I upload theme changes via FTP as root and constantly have to redo permissions on my server using the following command:

find . -type d -exec chmod 777 {} \; && sudo find . -type f -exec chmod 666 {} \; && sudo chmod u+x bin/magento

Thanks, Nick

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.