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

Swaz's avatar
Level 20

config:cache does not use variables from env file

I'm using Cashier and have STRIPE_PRODUCT_ID and STRIPE_PLAN_ID defined in my env file on Forge. These variables are only being referenced using the config() helper, not via the env() helper.

When I run php artisan config:cache in production, I get an error stating that I passed an empty string to Stripe.

When I run php artisan config:clear everything works fine.

Why can't I use php artisan config:cache in production?

0 likes
3 replies
Sinnbeck's avatar

Have you tried searching through all files for env in the app folder?

grep -r 'env(' ./app
Swaz's avatar
Level 20

Thanks for the reply. I've checked about 10 times now lol. I am 100% not referencing anything with env(). php artisan config:cache works fine locally as well.

Sinnbeck's avatar

Ok fair enough :) What if you call the config from php artisan tinker?

Sorry dont know the name of the config entry as I dont use stripe :)

config('stripe.config.name')

Oh and is the config file in your /config directory? Can you show the contents?

Please or to participate in this conversation.