SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Member
    Join Date
    Jan 2005
    Location
    US
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    SetEnv and Functions

    I am using setenv in my .htaccess file. The line of code is similar to this:

    SetEnv PATH /usr/local/root/sitestuff/dir

    This works great, and I can access this variable everywhere by using $PATH...except from within functions. Is there any reason that would be?

  2. #2
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Have you tried $_ENV['PATH'] ?

  3. #3
    SitePoint Member
    Join Date
    Jan 2005
    Location
    US
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes. It's odd. This function is in an included file. If I echo $PATH outside of the function, it exists, if I echo it inside of the function it doesn't. And I know it's being called because I preceded it by echo "hello".$PATH and the hello is printing.

  4. #4
    SitePoint Guru
    Join Date
    Nov 2004
    Location
    Parry Sound, ON
    Posts
    725
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well, I'm asuming you have register_globals on, and that's why you can use $PATH. But $PATH isn't a superglobal like $_ENV is, and won't be available within functions unless you global $PATH inside the functions. So are you sure you tried $_ENV['PATH']? What version of PHP do you use etc.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •