Jump to content

Archived

This topic is now archived and is closed to further replies.

onegative

Environmental Variables

Recommended Posts

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

Share this post


Link to post
Share on other sites
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:

[code]
putenv('HOME=/opt/app/p1momw1');
[/code]

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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.