Menu

Fixing 'storage/logs/laravel.log could not be opened: Permission denied' in Linux & Docker
📰

Fixing 'storage/logs/laravel.log could not be opened: Permission denied' in Linux & Docker

DEV Community: php·Chathura Rathnayaka·8 days ago
#iUu5ZypI
#devto#dev#user#storage#article
Reading 0:00
15s threshold

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.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.