Skip to content

Fix this error

Laravel: No application encryption key has been specified

Dasun Kalupahana 300 views

The error

Error

No application encryption key has been specified.

Why it happens

APP_KEY in .env is empty or missing. Laravel needs it to encrypt cookies and sessions. This usually happens right after cloning a project or copying .env.example, or when an old cached config is still loaded.

How to fix it

  1. Generate a key. It writes APP_KEY=base64:... into .env.
  2. Clear the cached config so Laravel reads it.

Do not generate a new key on a live site that already has users: existing sessions and encrypted data become unreadable. Copy the existing key instead.

php artisan key:generate
php artisan config:clear
Still stuck? Send us the full error and what you tried. We add the answers here.

Learn more on the blog

Get new articles in your inbox

Practical tutorials and deep dives, about once a week. No spam, unsubscribe anytime.

Privacy policy

Add DEV Talk to your Home Screen

  1. 1 Tap the Share button in Safari's toolbar.
  2. 2 Scroll down and tap Add to Home Screen.
  3. 3 Tap Add. Open it from the Home Screen to read like an app and to turn on notifications with the bell.

We use cookies to improve your experience and analyze traffic. By continuing, you agree to our Privacy Policy.