skip to Main Content

installed laravel on my xampp installation on ubuntu. opened it in browser. got the error:

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

how to fix? (i’ve already found an answer, will post right now)

2

Answers


  1. Chosen as BEST ANSWER

    the problem is that the user under which the apache runs doesn't have access to the folder. in xampp on ubuntu, the user of main apache process is root. but apache workers run under daemon user. the solution is to grant daemon access to the /storage dir. (if you'll only grant to /storage/logs than you'll fix this error, but the same error will occur with sibling dirs. thus the storage itself folder:

    sudo chown -R daemon /path-to-your-project/storage
    

    now the daemon user has access to this folder (and you don't but do you need it? if you have better solutions, please feel free to share them here!


  2. Add to composer.json

        "scripts": {
        "post-install-cmd": [
              "chgrp -R www-data storage bootstrap/cache",
              "chmod -R ug+rwx storage bootstrap/cache"
         ]
    }
    

    Then run composer install or update solve your issue

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search