php get environment variable
snippet in php

php get environment variable

user9963

$value = getenv("VARNAME");
// returns FALSE if VARNAME does not exist

$env_vars = getenv();
// if no name is specified, an associative array 
// with all environment variables is returned

php set environment variable

user518

putenv('NAME=VALUE');

// NAME may contain whitespaces ->
putenv('NAME=VALUE') 
// is not equivalent to 
putenv('NAME = VALUE')