Accessing OS env variables? - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: Accessing OS env variables? (/showthread.php?tid=80174) |
Accessing OS env variables? - dzhi - 09-23-2021 I'm figuring out how to deploy CI3 project with Kubernetes and ran into a problem with environment variables. Namely, in my Kubernetes YAML manifests I declare several environment variables depending on the application environment (dev/staging/production). I can see those variables when I run env in container CLI but for some reason, I can't access out those variables with PHP. I tried several things: 1. I configured clear_env = no in my PHP-FPM pool config (www.conf) - Didn't work 2. I configured variables_order = "EGPCS" in php.ini - Didn't work Any suggestions on how do I access OS environment variables? Thanks in advance! RE: Accessing OS env variables? - kenjis - 09-23-2021 > I can't access out those variables with PHP. What did you do? and what did you get? RE: Accessing OS env variables? - dzhi - 09-25-2021 (09-23-2021, 05:09 PM)kenjis Wrote: > I can't access out those variables with PHP. Basically, tried accessing OS env vars via getenv() just to print them out and confirm that they're accessible. Any suggestions? RE: Accessing OS env variables? - InsiteFX - 09-26-2021 Did you try using this one? PHP Code: echo $_ENV["VAIABLENAME"]; Try it and see what you get back. RE: Accessing OS env variables? - paliz - 09-26-2021 call getenv() function |