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:
clear cache
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.
By now you should be able to solve "No Application Encryption Key Has Been Specified" error. Cheers and happy coding!
Leave a reply