hi all.. I want to get the environment variables in my php script. ie php exec('source /pth/to/var/file'); where variable file contains variable list. like export Var1=Value1... I cant use Var1 inside my script even after sourcing it.. Please tell whether I am going wrong or is there another method for it.. Thanking you
Give this a gander. I think you are making it harder than it is, but then again, I don't know what env vars you are refering to. http://us.php.net/reserved.variables http://us3.php.net/getenv I hope this helps. Usually with the method I see you trying, you would use one of these instead: include($file); include_once($file); require($file); require_once($file); But not for env vars.
Thanks for the reply. my file looks like export Var=Value. In shell scripts we 'source' the file and use $Var in the script. Cant we do the same in php.