Home / Snippets / How to Solve Laravel No Application Encryption Key Has Been Specified
How to Solve Laravel No Application Encryption Key Has Been Specified cover

How to Solve Laravel No Application Encryption Key Has Been Specified

8.2K

3 years ago

0 comments

Sometimes you might come across the "Laravel No Application Encryption Key Has Been Specified" error in Laravel and this commonly happens during a new Laravel project initialization. To solve this issue you will have to generate a APP_KEY which is located within your .env (environment) file.
APP_KEY=
To generate the key you can run the Laravel Artisan key generate command.
php artisan key:generate
Once you have generated it you can try again and refresh your Laravel application in the browser to see if the page is running or not. If it's still showing the same error then you might need to:
  1. clear cache
  2. restart your development server
To clear the cache you can use the artisan command as well.
php artisan config:clear
If you are using Valet as the development server then it will be automatically read the .env changes otherwise run
valet restart

No Application Encryption Key Has Been Specified Laravel 8?


If you are using Laravel 8 then you are in luck, whenever you are seeing this error you can press the "Generate Button" from the browser itself.
Laravel 8 No Application Encryption Key Has Been Specified

By now you should be able to solve "No Application Encryption Key Has Been Specified" error. Cheers and happy coding!

Other Reads

notion avatar

Alaz

Week-end developer currently experimenting with web, mobile, and all things programming.

Topics:

Frontend

Resource

Average

Average

Support Us

If you like our tutorial, support us by being our Patreon or buy us some coffee ☕️

Welcome to PostSrc V3

PostSrc Dark Logo

You have to login to favorite this