24
22

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.

【Laravel7】There is no existing directory at "storage/logs" and its not buildable: Permission denied

Last updated at Posted at 2020-04-12

環境

  • PHP 7.4.4
  • Laravel 7.5.1

エラー

スクリーンショット 2020-04-12 17.34.18.png

There is no existing directory at "/work/backend/storage/logs" and its not buildable: Permission denied
in /work/backend/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php (line 171)
in /work/backend/vendor/monolog/monolog/src/Monolog/Handler/StreamHandler.php -> createDir (line 99)
in /work/backend/vendor/monolog/monolog/src/Monolog/Handler/AbstractProcessingHandler.php -> write (line 42)
in /work/backend/vendor/monolog/monolog/src/Monolog/Logger.php -> handle (line 323)
in /work/backend/vendor/monolog/monolog/src/Monolog/Logger.php -> addRecord (line 541)
in /work/backend/vendor/laravel/framework/src/Illuminate/Log/Logger.php -> error (line 174)
in /work/backend/vendor/laravel/framework/src/Illuminate/Log/Logger.php -> writeLog (line 87)
in /work/backend/vendor/laravel/framework/src/Illuminate/Log/LogManager.php -> error (line 547)
in /work/backend/vendor/laravel/framework/src/Illuminate/Foundation/Exceptions/Handler.php -> error (line 122)

原因

storage ディレクトリに書き込み権限がないため。

対策1

$ php artisan config:clear

対策2

$ chmod -R 775 storage bootstrap/cache

The stream or file "storage/logs/laravel.log" could not be opened: failed to open stream: Permission denied エラーが出たときの対処法 こちらと同様にパーミッションの場合もあります。

storagebootstrap/cache の2つのディレクトリは書き込み権限を付与してあげる。

24
22
1

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
24
22

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?