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
Please support us by disabling your ad-block. The revenue help us create more content for the community.
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.
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:
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
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!