Everytime I install a new module on my Magento 2, I got an error that the cache cannot be created because of the permission. All what I need to do is to run the following command to fix it.
chmod -R 777 var/
What should I do to fix this permission issue without running the command chmod everytime when a new module is installed?
Best Answer
First Set proper permission to your setup as per magento2 permission guidelines.
You need to add your current group to apache user.
For Ubuntu:
For CentOs:
If you have any issue after this, then you can simply grant ownership of any inaccessible files or folders by below command.
For the entire folder.
For single file.