This is a discussion on Set Path in *nix within the PHP Language forums, part of the PHP Programming Forums category; I need to be able to set the command path from PHP on any *nix system, any shell. I know ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I need to be able to set the command path from PHP on any *nix system, any
shell. I know there are different formats depending on the shell; when I do a getenv(), it shows the colon-delimited format, but when I try to change it with putenv(), it's ignored, no matter what format I use, or even if I give it just a single path. -- Alan Little Phorm PHP Form Processor http://www.phorm.com/ |
|
|||
|
Alan Little wrote:
> I need to be able to set the command path from PHP on any *nix system, any > shell. I know there are different formats depending on the shell; when I do > a getenv(), it shows the colon-delimited format, but when I try to change > it with putenv(), it's ignored, no matter what format I use, or even if I > give it just a single path. Can you give a code sample of exactly what you're doing? Normally something like this should work: putenv('PATH=/bin:/usr/bin:/foobar'); # ... run commands requiring PATH change As far as I know, this shouldn't be shell-dependent. (Remember that changes to the environment will only be in effect for the process you change it in and any child processes you spawn afterwards. So for instance running a PHP script from a shell will not change the environment in the shell that you ran it from.) -- brion vibber (brion @ pobox.com) |