LoginSignup
0
1

More than 3 years have passed since last update.

artisan up/downがファイル書き込み権限エラーになる

Posted at

Laravelのメンテナンスモードを有効化無効化するartisan up/downコマンドだが、storageディレクトリにApacheなどWebサーバの権限を与えてるとSSHユーザーでコマンドを実行したときに権限エラーになってしまう。

$ php artisan down
Failed to enter maintenance mode.
file_put_contents(/home/user/app/storage/framework/down): failed to open stream: Permission denied

sudo chown -R 777 storageで一時的に権限を変えて書き込めるようにしてもよいが、suでWebサーバーのユーザーに成り代わって書き込むこともできる。

$ sudo -u apache php artisan down
Application is now in maintenance mode.
$ sudo -u apache php artisan up
Application is now live.
0
1
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
0
1