You should not pull env variables directly.
create a config file that pulls in .env variables and then use that in your code. This way you can use the cached config.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello!
I recently updated Laravel from 5... to 6...
Now when I click my buy-buttons I do not get redirected to the stripe purchase page.. On the server. Locally to the test links in stripe it works just fine!
I have stripe integration like this on a blade, the script includes:
var stripe = Stripe('{{env('STRIPE_PUB_KEY')}}');
This works fine locally rendering my stripe public key that I have in my .env but on my server it does not work.. On both server and locally I have Laravel v. 5.7.28 php version server 7.3.12 php version locally 7.4.4
Yes, I have a variable in both my .env on server and locally called STRIPE_PUB_KEY...
This drives me nuts.. What can be the difference. Can it really be the php version?
You should not pull env variables directly.
create a config file that pulls in .env variables and then use that in your code. This way you can use the cached config.
Please or to participate in this conversation.