The stream or file “/logs/laravel-YYYY-MM-DD.log” could not be opened: failed to open stream: Permission denied

Error :

The stream or file “/logs/laravel-YYYY-MM-DD.log” could not be opened: failed to open stream: Permission denied

throw new \UnexpectedValueException(sprintf(‘The stream or file “%s” could not be opened: ‘.$this->errorMessage, $this->url));

Why :

Permission issue to create and open file

Solution :

Go to

config/logging.php

 

find code

'single' => [
    'driver' => 'single',
    'path' => storage_path('logs/laravel.log'),
    'level' => 'debug',
],

add ‘permission’ => 0777

'single' => [
    'driver' => 'single',
    'path' => storage_path('logs/laravel.log'),
    'permission' => 0777,
    'level' => 'debug',
],

 

find code

'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.log'),
    'level' => 'debug',
    'days' => 14,
],

add ‘permission’ => 0777

'daily' => [
    'driver' => 'daily',
    'path' => storage_path('logs/laravel.log'),
    'level' => 'debug',
    'permission' => 0777,
    'days' => 14,
],

 

Was this article helpful?

Related Articles

Leave A Comment?

You must be logged in to post a comment.