Env variable can't be read by laravel
I've deployed my Laravel app and already set the env vars, but when I checked the log it can't read the env. Can someone help me?
Solution:Jump to solution
Mine was raw php, I was using
getenv()
and $_ENV
to get the env vars, but the correct way was using $_SERVER
9 Replies
Project ID:
aa2a5d94-9bd2-48c1-9fc2-09c09a301603
project id:
aa2a5d94-9bd2-48c1-9fc2-09c09a301603
@Medim - I'm pretty sure you've faced this issue before right? could you lend a hand here? (silent ping failed me)
Solution
Mine was raw php, I was using
getenv()
and $_ENV
to get the env vars, but the correct way was using $_SERVER
Why? good question, i'm not that good with PHP I just mantain an archaic codebase but my guess is that it is 'cause the envs are provided by railway (the server, instead of a client session)
so is there any workaround?
please read medim's message
Iam using laravel framework, changing getenv() or $_ENV will not be only in one place. But ok if that's the only solution for now, thanks!
just replace all