Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

fastforward's avatar

No supported encrypter found

[2016-03-25 04:04:59] production.ERROR: RuntimeException: No supported encrypter found. The cipher and / or key length are invalid. in C:\xampp\htdocs\site\vendor\laravel\framework\src\Illuminate\Encryption\EncryptionServiceProvider.php:31

This thing happen once every ~2 minutes on random requests, I tried key:generate multiple times and cipher in config file is default AES-256-CBC any ideas how to fix this thing?

Im using laravel 5.2.24

0 likes
8 replies
acasar's avatar

Did you cache the config? If not, that could be a reason since multiple concurrent requests can't read the same .env file.

fastforward's avatar

@acasar well I have default caching configuration haven't changed anything about that, where and how can I cache config files?

mehany's avatar
mehany
Best Answer
Level 13

I reported the same issue a while ago here on this thread . The way i solved this is by adding a fallback on the key property in app.php like this

'key' => env('APP_KEY', 'S043rl4v4ABM4FtGhylMejtskvRipr2d'),

'cipher' => 'AES-256-CBC', 

Then i never saw this error again. I believe at some point the env() fails

1 like
acasar's avatar

@fastforward @mehany Config caching should solve that issue since .env files don't even get accessed then.

php artisan config:cache

fastforward's avatar

@mehany thanks I did this thing a hour ago already and made ajax request circle to check if error still shows up. Seems like it fix the problem.

@acasar wouldn't config caching be better only when site is in production state? Because Im still actively developing it and if ill need to change something in config ill need to recache it again?

fastforward's avatar

Late response, but I found out why env fails, apache causing these fails. I switched from Apache to Nginx around 1 and half week ago and havent seen a single env fail on any request.

leolam2005's avatar

php artisan config:cache might do the trick, but what if lumen? there is no such command

Please or to participate in this conversation.