Set Path in *nix

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 ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 12-02-2004
Alan Little
 
Posts: n/a
Default Set Path in *nix

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/
Reply With Quote
  #2 (permalink)  
Old 12-03-2004
Brion Vibber
 
Posts: n/a
Default Re: Set Path in *nix

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)
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 08:05 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0