feresr feresr - 1 year ago 199
PHP Question

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

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.


Answer Source

So, if anyone else is having this problem, here's what you do.

  1. Get out of the VM
  2. Using the console, go to your synced folder (vagrant)
  3. $ sudo chmod -R 777 app/storage

Even though I created the project within the VM using the VM user, the folder belonged to the user in the real computer; so, whent trying to did chmod 777 I got chmod 775.

Now it's working.

Thanks to all those that helped me figure this thing out


Actually, it wasn't working, it still gave me a "permission denied" problem.

Here's what I did, I modified my Vagrantfile like this:

config.vm.synced_folder "./app","/var/www/", create:true,
:owner => "vagrant",
:group => "www-data",
:mount_options => ["dmode=775","fmode=664"]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download