Jump to content


Photo

Environmental Variables


  • Please log in to reply
1 reply to this topic

#1 onegative

onegative
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 13 June 2006 - 07:10 PM

G'day All,

I am trying to understand how to define specific environmental variables needed to run a system command from php? I am using the system() to call the command but even though the user account has the environmental variable set, it does not appear to be used when issuing the command from within my php code.

Not sure what I am missing and all the searches I have done with regard to defining environmental variables within php code seem vague if not non-existant.

Any help would be appreciated and thanks in advance...

DannyG

#2 onegative

onegative
  • Members
  • PipPip
  • Member
  • 14 posts

Posted 13 June 2006 - 08:24 PM

OK,

I figured it out. You can use the putenv() function to add environmental variables if you are not running php in safe mode. It allows you to do something as follows:

putenv('HOME=/opt/app/p1momw1');

This allows the php script to use this environmental each time the script is called. I would assume you could also use an include file if it was needed in multiple pages...

Anyway, I am glad...

DannyG




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users