phplaravellaravel-5laravel-artisan

No Application Encryption Key Has Been Specified


I'm trying to use the Artisan command like this:

php artisan serve

It displays:

Laravel development server started: http://127.0.0.1:8000

However, it won't automatically launch and when I manually enter http://127.0.0.1:8000 it shows this error:

RuntimeException No application encryption key has been specified.

What's the cause of this problem, and how can it be fixed?

I'm using Laravel framework 5.5-dev.


Solution

  • From Encryption - Laravel - The PHP Framework For Web Artisans:

    Before using Laravel's encrypter, you must set a key option in your config/app.php configuration file. You should use the php artisan key:generate command to generate this key

    I found it using this query in google.com: "laravel add encrption key" (Yes, it worked even with the typo!)

    Note that if the .env file contains the key but you are still getting an application key error, then run php artisan config:cache to clear and reset the config.