I am using Magento 2.3.1 and I am getting that error on my Magento after given 0777 permission on my var folder

i am using that command : -sudo chmod -R 0777 var/

Uncaught UnexpectedValueException: The stream or file

"/var/www/html//var/log/system.log" could not be opened: failed to

open stream: Permission denied in


and my permission is

drwxr-xr-x.  5 apache apache   64 Aug 20 16:21 .
drwxr-xr-x. 17 apache apache 4096 Aug 19 21:23 ..
drwxr-xr-x.  4 root   root     36 Aug 20 16:21 cache
drwxr-xr-x.  3 root   root     34 Aug 20 16:21 composer_home
-rwxr-xr-x.  1 apache apache  124 Aug 20 16:37 .htaccess
drwxr-xr-x.  2 root   root     39 Aug 20 16:29 log

So please help me..!

2 Answers 2


Try below steps:-

sudo rm -rf var/*
sudo rm -rf pub/static/frontend/*
sudo rm -rf generated/*

sudo chmod -R 777 /var/www/html/(project name)/
sudo php bin/magento setup:upgrade
sudo php bin/magento setup:static-content:deploy -f
sudo php bin/magento ca:cl
sudo php bin/magento ca:fl
sudo chmod -R 777 /var/www/html/(project name)/
  • 1
    try this commands
    – Devidas
    Aug 20, 2019 at 12:00

try giving permission using this command

sudo chmod -R 777 /var/www/html/jazz/var/log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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