17
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

laravel ログファイルのpermission denied 対処

Last updated at Posted at 2019-12-06

原因はphp artisan経由のログはプロセスがユーザーなので更新or作成が所有者がユーザーになるが
ブラウザ経由だとapache(nginx)になるため、相互で書き込もうとすると拒否される。

対処1:ログファイルの出力先を変える

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

対処2:ログファイルの設定を変える

ロギング Laravel
daily、singleのパラメータにpermissionがあるのでこちらを設定する
値は664ではなく0664

config/logging.php
       'daily' => [
            'driver' => 'daily',
            'path' => storage_path('logs/laravel.log'),
            'level' => 'debug',
            'days' => 14,
            'permission' => 0664,
        ],
17
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?