Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

shell Environment Variables

Status
Not open for further replies.

dneff

Programmer
Aug 15, 2002
8
US
Hello,

This may be more of a Linux question, but perhaps somebody knows the answer.

I can use getenv() to get environement variables, but I'm not sure where to set environment variables in linux so they can be seen from PHP.

I've tried setting my variable in /etc/profile but it still isn't available from PHP's getenv() function. I've even tried exec("myvar=hello");getenv("myvar"); with no success.

Thanks,

-David
 
Are you running PHP as an Apache module or as a shell script interpreter?
If the first, then you would have to set the environmental variable somewhere in your Apache configuration. If the latter, the variables should be available. //Daniel
 
PHP is an Apache module. I've tried putting SetEnv <var> <val> in the VirtualHost without success. Is this where I would put it?

Thanks
 
Actually, it looks like the SetEnv did in fact work. Sorry for the last reply, and THANK YOU for the help.

-David
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top