Error: No Application Encryption Key has been Specified in Laravel 5

production.ERROR: No application encryption key has been specified. {"exception":"[object] (RuntimeException(code: 0): No application encryption key has been specified. at ../vendor/laravel/framework/src/Illuminate/Encryption/EncryptionServiceProvider.php:42)

This Error usually across on the fresh installations of Laravel, You might have came across this issue on

 

Most like the application have a Application Encryption key set. Thus we need to generate a fresh Application Encryption key.

You can easily solve this error by running artisan key:generate command on your terminal at project root directory.

php artisan key:generate

 

This command should generate a key file in your .env file located at the project root.

If you don't yet have a .env file at your project root then you should create one by copying the contents of file .env.example

Once you have created the .env file, run the command again and make sure that there is a key generated at property APP_KEY in the file.

[caption id="attachment_1085" align="aligncenter" width="648"]No application encryption key specified in Laravel 5 APP_KEY Laravel[/caption]

After this run the following commands to clear the cache.

php artisan config:clear
php artisan confg:cache

Try accessing the application again, It should work without "No application encryption key" Error

 

Comments