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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unix Environment Variables 1

Status
Not open for further replies.

boborama

Programmer
Dec 7, 2000
10
US
Sorry Folks...another CGI newbie here.
I need access to one or more "Unix Environment Variables" in my CGI (Perl or Ksh) script.
I realiize that CGI takes several environment variables from the server...but I need access to UNIX user level environment variables.

If I execute a cgi script from the command line(ksh in this instance) that does:
echo $MYDBASE

The cgi script correctly answers: /mysys/mydbase
But when I run this from a web link I get nada - nothing.
I even made certain I was logged in as the same "user" when I tested the cgi.

I tried adding stuff to the .profile of and stopping/starting the web server process. No luck.
I see info on how to "exec" scipts as another user...but I think that just updates certain "permissions" and doesn't apply a user environment.

Anybody have an idea?
 
Hi

Depends on server settings, passing some environment variables may be restricted.

And where is that [tt]$MYDBASE[/tt] variable seted ? Note that some shell configuration files are processed only when the shell runs interactive.

Feherke.
 
Use Env;

might sort it out
--Paul


Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Thanks for the input folks.
I finally managed to find what I wanted..one way (the way I selected) was to use the PassEnv option on our web server. This allows you to add additional server environment variables which are initialized to the shell environment variable value (applicable to the user who started the server). So after I updated the httpd_conf file I just stopped and restarted the server. Presto. Some new server environment variables that evaluate to what I needed. All of my scripts which need these "shell" variables have them.
Of course I had to PassEnv each and every shell varaiable (only needed about a dozen). Ill try "Use Env" in Perl as that might set them all at once with no conf file changes.
 
* for that, I need to spend more time in the Apache Forum
--Paul

Spend an hour a week on CPAN, helps cure all known programming ailments ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top