Posts Learn Components Snippets Categories Tags Tools About
/

How to Solve Laravel No Application Encryption Key Has Been Specified

Learn how to solve the No Application Encryption Key Has Been Specified on newly created or initilaised project in Laravel

Created on Oct 04, 2021

8049 views

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

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

)