No Application Encryption Key Has Been Specified

前端 未结 20 1647
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-11-30 17:11

I\'m new to Laravel and I\'m trying to use the Artisan command...

php artisan serve

It displays...

Laravel developme

相关标签:
20条回答
  • 2020-11-30 17:41

    cp .env.example .env if there is no .env file present. php artisan key:generate command works for me. It generates the encryption key

    0 讨论(0)
  • 2020-11-30 17:42

    Sometimes If everything Fails Use this:

    Goto: laravelProject/config/app.php

    Find the line: 'key' => and check to what it refers,

    It can either be one of two:

    Case 1: env('APP_KEY') Case 2: "somekeystring"

    For Case 1: Goto your .env file after you have run cp -a .env.example .env Enter a random string like 10101010101010101010101010101010

    Now, run php artisan key:generate

    Your key will be updated automatically.

    For Case 2: set a random string like for value of Key 10101010101010101010101010101010

    Now, run php artisan key:generate

    Your key will be updated automatically.

    0 讨论(0)
  • 2020-11-30 17:43

    In my case, while cloning the project from git there was no .env

    file. So I copy the .env file from the source project and paste in my current project and change its configuration of database and it run successfully.

    0 讨论(0)
  • 2020-11-30 17:44
    1. Copy .env.example to .env:

      cp -a .env.example .env

    2. Generate a key:

      php artisan key:generate

    3. Only then run:

      php artisan serve

    0 讨论(0)
  • 2020-11-30 17:48

    Follow this steps:

    1. php artisan key:generate
    2. php artisan config:cache
    3. php artisan serve
    0 讨论(0)
  • 2020-11-30 17:48

    If you git clone some project then this kind of issue may usually occur.

    1. make sure there is .env file
    2. run php artisan key:generate and then it should generate APP_KEY in .env
    3. finally run php artisan serve and it should be working.
    0 讨论(0)
提交回复
热议问题