用這篇文章來記錄laravel開發中遇到的問題
laravel報錯,storage/logs檔案沒許可權
報錯內容:
UnexpectedValueException: There is no existing directory at "/Users/liuyunlong/www/laravel-shop/storage/logs" and it could not be created: Permission denied in file /var/www/html/laravel-shop/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php on line 172
解決辦法:
- 檢視資料夾許可權、所屬者、所屬組
- 檢視是否有root使用者的計劃任務,也在使用此檔案寫日誌
- 清除快取(我使用這種方法之後就可以了)
php artisan route:clear php artisan config:clear php artisan cache:clear
- 修改配置檔案,增加0664許可權
參考連結:qastack.cn/programming/27674597/la...'daily' => [ 'driver' => 'daily', 'path' => storage_path('logs/laravel.log'), 'level' => 'debug', 'days' => 7, 'permission' => 0664, ],
本作品採用《CC 協議》,轉載必須註明作者和本文連結