No Application Encryption Key Has Been Specified

前端 未结 20 1812
爱一瞬间的悲伤
爱一瞬间的悲伤 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:30

    Okay, I'll write another instruction, because didn't find the clear answer here. So if you faced such problems, follow this:

    1. Rename or copy/rename .env.example file in the root of your project to .env.

    You should not just create empty .env file, but fill it with content of .env.example.

    1. In the terminal go to the project root directory(not public folder) and run

    php artisan key:generate

    1. If everything is okay, the response in the terminal should look like this

    Application key [base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=] set successfully.

    1. Now just copy key itself and paste it in your .env file as the value to APP_KEY. Result line should look like this:

    APP_KEY=base64:wbvPP9pBOwifnwu84BeKAVzmwM4TLvcVFowLcPAi6nA=

    1. In terminal run

    php artisan config:cache

    That's it.

提交回复
热议问题