7

Magento 2 below the Warning come.

Warning: file_put_contents(/var/www/html/var/cache//mage-tags/mage---792_CONFIG): 
failed to open stream: Permission denied in /var/www/html/vendor/colinmollenhour/cache-backend-file/File.php on line 663

Please Help.

After changing permissions I got an error "Class Magento\Review\Model\ReviewFactory does not exist"

Ok, I fixed above error by deleting generation folder and making static content deploy

  • 2
    var folder should have write permission. – Sohel Rana Oct 19 '16 at 7:32
  • run commands as sudo – mikebertiean Feb 2 '17 at 19:22
  • I have the same problem. I can fix it by running a chmod command, but it reoccurs when I run cache:clean or someting else. I think the real problem is some extension that sets the permissions wrong. But how can we fix that? – Rick Jul 24 '18 at 8:49
4

Magento told you that you don't have permissions to write in /var/cache folder, please check what are the permission of the /var folder.

Overview of ownership and permissions Magento 2

2

I tried with sudo bin/magento setup:di:compile and works fine.

1

You can try changing all permissions by using the following command

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

I know it's not the prettiest solutions, but it worked for me.

0

you have a permission problem

Fix it by using this cmd : chmod 755 -R var/*

0

I think it's not a bug, I experienced the same after running the cache: clean command as root user.

So by applying for the file permission again, this issue has been fixed. http://devdocs.magento.com/guides/v2.2/install-gde/prereq/file-sys-perms-over.html

So be careful don't clean the cache as root/sudo user

0

For anyone that has recently had this problem. I fixed this in my staging environment by running the chmod 755 -R var/* command, but make sure you do it to the /var directory and not /var/www/html/var. Hope it makes sense. I am quiet new to Linux so it took a while for me to get my head around.

This is also a very important reard https://devdocs.magento.com/guides/v2.3/install-gde/prereq/file-sys-perms-over.html

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.