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

chack1172's avatar

API encryption key issue

Hello, in both laravel and lumen some api gives error "No application encryption key has been specified.". In my .env APP_KEY has a value and the error happens only with 10% of requests, not all. What could be the cause? I run them in windows with apache.

Thank you

0 likes
5 replies
bugsysha's avatar

I run them in windows with apache.

There is your reason. But it might be bunch of other stuff.

Go through the log files and see if you can find some reproducible steps for that error. Write test that proves that the error exists. Fix the error and test should become green.

ishahzeb's avatar

Before using Laravel's encrypter, you must set a key option in your config/app.php configuration file. You should use the php artisan key:generate command to generate this key"

You can find the generated application key(APP_KEY) in the .env file.

chack1172's avatar

The app_key and cipher are present in config and env file. As I said the error happens only with a few requests and I don't know a way to test it.

Please or to participate in this conversation.