Title says it. I want to use this with proc_open, to append some variables to the current environment.
$current_env = get_all_env_vars_magically();
$env = array_merge($current_env, $new_vars);
$ph = proc_open($command, array(1 => array('pipe', 'w')),
$pipes, dirname(__FILE__), $env);
Edit: $_ENV
is empty/not populated by default. $_SERVER
contains so much more than env vars.
Since PHP7.1 the varname can now be omitted to retrieve an associative array of all environment variables.
try getenv()
https://3v4l.org/fkFoR
PHP Docs: https://www.php.net/manual/en/function.getenv.php
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With