How to Fix Error: Laravel.Log Could Not Be Opened

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

To fix this issue, you need to change the ownership of the directory to the unix user that the webserver uses.

  1. Get out of the VM
  2. Using the console, go to your synced folder (vagrant)
  3. sudo chown -R $USER:www-data storage
  4. chmod -R 775 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, when trying to

Now it's working.

Thanks to all those that helped me figure this thing out

EDIT:

Actually, it still 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"]

laravel.log could not be opened: failed to open stream

You need to run one of the following:

  • sudo chmod -R 644 app/storage
  • sudo chmod -R 755 app/storage

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

If you run the command with sudo or chmod -R 755 some of the project's folders, you'll have it working.

sudo chmod -R 755 storage bootstrap/cache

Changing entire project folder's permission is probably not a good idea as your project becomes accessible to any user/script which kind of defeats the purpose of securing it behind root.

storage/logs/laravel-2019-11-22.log could not be opened: failed to open stream: Permission denied

Alright I got the answer:

AWS AMI uses webapp as the web user, not apache or ec2-user as the file shows. In that case, the webapp user has no access rights over those files.

sudo chown $USER:webapp ./storage -R

find ./storage -type d -exec chmod 775 {} \;

find ./storage -type f -exec chmod 664 {} \;

Laravel with Docker laravel.log could not be opened in append mode: Failed to open stream: Permission denied

Answer:

chown -R www-data storage

  • Make www-data the owner.

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

Google Cloud is a write only filesystem. For directories which need to be written into by the application, you will need to make some modifications.

Please see https://cloud.google.com/community/tutorials/run-laravel-on-appengine-standard and make note of steps 1 and 3 under the deploy section, which set the APP_STORAGE path to /tmp so that it will be writable.



Related Topics



Leave a reply



Submit