No Application Encryption Key Has Been Specified

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

    In my case, I also needed to reset the cached config files:

    php artisan key:generate
    php artisan config:cache
    
    0 讨论(0)
  • 2020-11-30 17:52

    A common issue you might experience when working on a Laravel application is the exception:

    RuntimeException No application encryption key has been specified.

    You'll often run into this when you pull down an existing Laravel application, where you copy the .env.example file to .env but don't set a value for the APP_KEY variable.

    At the command line, issue the following Artisan command to generate a key:

    php artisan key:generate
    

    This will generate a random key for APP_KEY, After completion of .env edit please enter this command in your terminal for clear cache:php artisan config:cache

    Also, If you are using the PHP's default web server (eg. php artisan serve) you need to restart the server changing your .env file values. now you will not get to see this error message.

    0 讨论(0)
提交回复
热议问题