Home > Software engineering >  How do I change directory permissions for laravel logs?
How do I change directory permissions for laravel logs?

Time:10-13

I am looking for a more detailed answer from the following resolved issue "The stream or file "laravel.log" could not be opened: failed to open stream: Permission denied"

I am still new to web development and when entering the suggested command (sudo chown -R $USER:www-data storage) in the terminal I get the following error: chown: invalid group: ‘root:www-data’

I have also tried (sudo chown -R www-data:www-data /home/EXAMPLE/EXAMPLE) leading to my project folder but got the following error: chown: invalid user: ‘www-data:www-data’

I am doing this to fix a permissions issue:

The stream or file "/home/EXAMPLEURL/EXAMPLEURL/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied.

Thank you!

CodePudding user response:

Run this below command in your server/terminal

chmod -R 775 storage

It changes read/write permission for the storage folder.

CodePudding user response:

Unlike Debian/Ubuntu, CentOS doesn't use www-data.

I'm pretty sure that the user and group is apache in your case. So, something like the following should do the trick:

sudo chown -R apache:apache /home/EXAMPLEURL/EXAMPLEURL/storage
  • Related