Error laravel log could not be opened

+2 votes

For some reason I keep getting this error (I haven't even started coding yet)

Error in exception handler: The stream or file "/var/www/laravel/app/storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied in /var/www/laravel/bootstrap/compiled.php:8423

I have read this has something to do with permissions but chmod -R 775 storage didn't help at all.

Apr 2, 2020 in Laravel by kartik
• 37,510 points
11,823 views

1 answer to this question.

+1 vote

Hello,

Never use 777 for directories on your live server, but on your own machine, sometimes we need to do more than 775, because

chmod -R 775 storage

Means

7 - Owner can write
7 - Group can write
5 - Others cannot write!

If your webserver is not running as Vagrant, it will not be able to write to it, so you have 2 options:

chmod -R 777 storage

or change the group to your webserver user, supposing it's www-data:

chown -R vagrant:www-data storage

Hope this helps!

Thank You!

answered Apr 2, 2020 by Niroj
• 82,880 points
Thanks for this....it worked

Related Questions In Laravel

+1 vote
1 answer

Error [PDOException]: Could not Find Driver in PostgreSQL?

Hii, I got this problem too. I have ...READ MORE

answered Mar 31, 2020 in Laravel by Niroj
• 82,880 points
28,574 views
+1 vote
1 answer

Error:Class '\App\User' not found in Laravel when changing the namespace in Laravel?

Hello @kartik Go to config/auth.php and change App\User:class ...READ MORE

answered Apr 3, 2020 in Laravel by Niroj
• 82,880 points
29,372 views
0 votes
1 answer

Error:Laravel [InvalidArgumentException] Script “post-install-cmd” is not defined in this package

Hello @kartik, Do composer global update before laravel new <project-name> and you'll ...READ MORE

answered Apr 6, 2020 in Laravel by Niroj
• 82,880 points
1,225 views
0 votes
1 answer

Error:Laravel PHP Command Not Found

Hello @kartik, Try the follwing snippet: nano ~/.bash_profile And ...READ MORE

answered Jul 30, 2020 in Laravel by Niroj
• 82,880 points
6,632 views
0 votes
1 answer

What is meant by passing the variable by value and reference in PHP?

Hello, When the variable is passed as value ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
2,913 views
0 votes
1 answer

Connection with MySQL server using PHP. How can we do that?

Hey @kartik, You have to provide MySQL hostname, ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
956 views
0 votes
1 answer

How to retrieve or obtain data from the MySQL database using PHP?

Hello kartik,  Actually there are many functions that  ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
2,978 views
0 votes
1 answer

What are the differences between mysqli_connect and mysqli_pconnect?

Hello, mysqli_pconnect() function is used for making a persistence ...READ MORE

answered Mar 27, 2020 in PHP by Niroj
• 82,880 points
3,294 views
0 votes
1 answer

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

Hello @kartik, Make your Dockerfile something as below ...READ MORE

answered Sep 30, 2020 in Laravel by Niroj
• 82,880 points
20,406 views
0 votes
1 answer

Error:Object of class Illuminate\Database\MySqlConnection could not be converted to string

Hello @kartik, The use keyword is what you need: $id = ...READ MORE

answered Sep 24, 2020 in Laravel by Niroj
• 82,880 points
3,137 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP