How to fix Error: laravel.log could not be opened?

2020-01-23 10:01发布

I'm pretty new at laravel, in fact and I'm trying to create my very first project. 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've read this has something to do with permissions but chmod -R 775 storage didn't help at all.

Permissions

标签: php laravel
19条回答
趁早两清
2楼-- · 2020-01-23 11:06

You need to adjust the permissions of storage and bootstrap/cache.

  • cd into your Laravel project.
  • sudo chmod -R 777 storage
  • sudo chmod -R 777 bootstrap/cache

Depending on how your web server is setup, you may be able to be more specific with your permissions, and only grant them to your web server user. Google WEB SERVER NAME Laravel file permissions for more information.

At the time of writing, this is for Laravel 5.4

查看更多
登录 后发表回答