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

December 19th, 2024 • 1 minute read time

Laravel relies on an application key to be set for encryption and other security purposes. If it's not set, you're not getting anywhere.

Here's what it should look like in your application's .env file:

APP_KEY=[somekey]

If this is missing for any reason, you'll see a MissingAppKeyException exception thrown, with the message "No application encryption key has been specified.".

If your APP_KEY has not been set for any reason during installing Laravel, all you need to do is run this command within your project:

php artisan key:generate

You'll always want to do this rather than set the APP_KEY manually yourself, as this command takes into account the cipher configured within your application, and will always generate a secure key.

If you found this article helpful, you'll love our practical screencasts.
Author
Alex Garrett-Smith
Share :

Comments

No comments, yet. Be the first!

Table of contents

Tagged under