Fix this error
Laravel: No application encryption key has been specified
Dasun Kalupahana 301 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
- Generate a key. It writes
APP_KEY=base64:...into.env. - 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
Learn more on the blog
PostgreSQL vs MySQL Performance: Real Benchmarks Compared
Last updated: 7 November 2026. See the update log at the end."Which...
Secure a Laravel App Before Production: Tested Checklist
Last updated: 8 November 2026. See the update log at the end.Laravel...
How to Detect and Fix PHP Memory Leaks
Last updated: 5 November 2026. See the update log at the end.In...