If you installed Laravel via Composer or the Laravel installer, this key has already been set for you by the php artisan key:generate command. Typically, this string should be 32 characters long. The key can be set in the.env environment file. If you have not copied the.env.example file to a new file named.env, you should do that now.
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.
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.
After this run the following commands to clear the cache.
Try accessing the application again, It should work without “No application encryption key” Error