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

kylemilloy's avatar

No application encryption key specified after config:cache

I'm trying to optimize an app in Elasticbeanstalk. I have the environment variables set and it works fine up until I run config:cache at which point it throws a 500 and the log spits out "production.ERROR: No application encryption key has been specified". If I printenv I can see the APP_KEY being listed here...not sure why it's not being picked up.

APP_DEBUG=false
APP_KEY=base64:my-key-is-here
PHP_DISPLAY_ERRORS=Off
0 likes
5 replies
bobbybouwmann's avatar

Mmh that doesn't make sense indeed. The cached version of the config files is always in bootstrap/cache/config.php.

bobbybouwmann's avatar

How do you set the environment variables? Do you set them in the configuration interface of aws?

bobbybouwmann's avatar
Level 88

@kylemilloy I think I found the answer why this is not working: https://stackoverflow.com/questions/48103280/laravel-configuration-cache-on-elastic-beanstalk#answer-51656470

So basically it doesn't grab the correct variables from beanstalk when running config:cache, only the variables from the .env and therefore it's now empty.

This might be a working solution: https://github.com/TheDMSGroup/laravel-eb/blob/master/.ebextensions/40_laravel.config

kylemilloy's avatar

Yep...mixture of permissions and post deploy scripts. Thanks.

Please or to participate in this conversation.