30
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Mac Laravel 500 server errorが出た話

Last updated at Posted at 2020-04-26

〜宣伝〜

個人開発でエンジニア専門マッチングサービスを開発しましたので、是非未経験からエンジニア目指している人!現役エンジニアで教えたい人!使ってみてください!

β版リリース記念キャンペーン中です!

10名様限定、抽選でお好きな技術本1冊プレゼント!
🎉当選者にはメッセージ差し上げます(送付の際に住所はお聞きしません)
詳しくはこちらから↓

https://x.com/dokupro01/status/1796837336145436846

目的

  • 環境構築直後にローカル開発環境で500 server errorが出た話をまとめる

エラー概要

  • $ php artisan serveを実行してブラウザでhttp://127.0.0.1:8000/を確認したところ500 server error(下記のもの)が出力された。

    BC3D17BD-A681-4E81-A83F-B40391C770AA.png

解決法

  1. アプリ名ディレクトリを確認すると.envが存在していないことがわかった。

  2. 下記コマンドを実行して.envを作成する。

    $ cd アプリ名ディレクトリ
    $ cp .env.example .env
    
  3. laravelアプリを再起動してブラウザを確認したところ下記の画面が表示されていた。

    • アプリケーションを暗号化するためのキーがない、もしくは設定されていないらしい。
    479CDDAB-834B-4E21-B3AA-339B422263BE.png
  4. 下記コマンドを実行して鍵を作成した。

    $ php artisan key:generate
    >Application key set successfully.
    
  5. laravelアプリを再起動してブラウザを確認したところ下記の画面が表示されており、問題は解決した。

    38C8B2E5-0A42-40B6-9A96-6C978FD4DD91.png
30
17
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
30
17

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?