How to fix No application encryption key has been specified error in Laravel Framework

How to fix No application encryption key has been specified error in Laravel Framework

Generally, when you pull Laravel from composer, given that you have met all the requirements, the framework works out of the box but there could be some situations where you may face a “No application encryption key has been specified.” Error upon accessing Laravel for the first time.

What causes No application encryption key has been specified error in Laravel Framework?

The reason why this specific error occurs is because Laravel, by default, expects you to use its encrypter which uses OpenSSL that provides AES-256 and AES-128 encryption. In order to take advantage of this, Laravel requires you to set a key which can be set in your .env file, which is then pulled to config/app.php file. If your Laravel Development project is missing this specific file, then you will run into this error.

How to fix No application encryption key has been specified error in Laravel Framework?

As we know, Laravel Framework keeps things very simple and elegant. To fix this, you must type this artisan command from your project directory and it will generate a new key for your Laravel Project and everything will start working immediately.

Command:

php artisan key:generate
How to fix No application encryption key has been specified error in Laravel Framework 1

2 Comments