You clone a repository onto a new Ubuntu VPS or spin up a Docker container, run composer install , open the browser or execute an Artisan command, and get hit with a fatal crash:
The stream or file "/var/www/html/storage/logs/laravel.log" could not be opened in append mode: Failed to open stream: Permission denied
The exception occurred while attempting to log: The stream or file ...
Enter fullscreen mode
Exit fullscreen mode
In many cases, the browser screen goes entirely blank or throws a 500 Internal Server Error without rendering an exception page at all. That happens because Laravel crashed while trying to write the error itself to storage/logs/laravel.log .
The most common advice found in old forum threads is to run chmod -R 777 storage . Do not do this on any server connected to the internet.…