Bug #3675: getenv("PATH") after putenv("PATH") doesn't show new value
| From: | bbrown at ibexa dot com | Date: | Wed, 01 Mar 2000 05:20:35 +0000 |
| Subject: | Bug #3675: getenv("PATH") after putenv("PATH") doesn't show new value | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-16178@lists.php.net to get a copy of this message | ||
From: bbrown@ibexa.com
Operating system: HPUX 10.20, Solaris 7
PHP version: 3.0.14
PHP Bug Type: Misbehaving function
Bug description: getenv("PATH") after putenv("PATH") doesn't show new
value
I am running 3.0.15, but bug database form doesn't have that as an option.
I need to modify the PATH environment variable in my script. I get the current value with
getenv("PATH"), then
modify it with putenv. If I do a subsequent getenv("PATH") to verify the change, it is not
shown. phpinfo(), however,
shows the changed variable. But is it being made available to child processes?
The following script reproduces the problem on both HPUX 10.20 and Solaris 7 running Apache 1.3.12
with PHP as a DSO.
<?
# Fetch PATH env var
$path = getenv("PATH");
echo $path . "<BR>\n";
# Append to the path
putenv("PATH=$path:/foo/bar");
# Print the changed path (?)
echo getenv("PATH") . "<BR>\n";
# phpinfo shows it correctly
phpinfo();
?>
The problem appears to only afflict the PATH variable; others work fine.