1

I am facing this issue in AWS Server,

The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied

And I give permission to "777",Now

sudo chmod -R 755 storage/

sudo chmod -R 777 storage/

ErrorException file_put_contents(/var/www/html/storage/framework/sessions/UMNbxoQBZjaUuZK7j4IHfRp3fWJF8pd688gnWX4o): failed to open stream: Permission denied

I receive this error Please help me to fix.

selva
  • 65
  • 1
  • 6

2 Answers2

0

as u r using CentOS 7.8

try sudo chcon -t httpd_sys_rw_content_t storage to give full permission to storage

Kamlesh Paul
  • 11,778
  • 2
  • 20
  • 33
0

This question is really trending when it comes to Laravel. The best suggestion I can give is change read/write/exec permissions of your storage folder like:

sudo chmod -Rf 755 storage

The -f is to make command run on subfiles and subdirectories all through

And make sure apache and user has access/ownership to storage folder like:

sudo chown -Rf username:apache storage

Importantly: Always avoid using 777 as it gives permission to anyone to have access to your files and folder outside your usergroup.

Selah!

Devmaleeq
  • 541
  • 6
  • 9
  • Check here https://stackoverflow.com/questions/17020513/laravel-4-failed-to-open-stream-permission-denied?rq=1 for more info – Devmaleeq Jan 05 '21 at 18:47