Passing non-standard environment variables to CGI scripts

Passing non-standard environment variables to CGI scripts

Post by Steve Waldma » Fri, 26 Jan 1996 04:00:00



I am writing scripts that require certain environment
variables in order to run.  (They use shared
libraries and require a LD_LIBRARIES_PATH variable).
I am using NCSA httpd.  The server runs scripts passing
only CGI-related in the environment, so my shared library
scripts crash and burn.

Currently I run a dummy script that sets up the environment
and then runs the real script, but this is cumbersome
and slow.

Does anyone know of a way to configure NCSA httpd to
pass extra environment variables to scripts?  Do other
servers have this capability?  (I have heard that CERN
httpd passes the environment it was run under to scripts
as well as CGI-related variables.)

Any suggestions would be appreciated... I like NCSA httpd,
so if anyone knows how to do what I need to with it,
I'd be especially grateful.

Thanks a lot.

                               Steve Waldman

 
 
 

Passing non-standard environment variables to CGI scripts

Post by Nathan Neuling » Mon, 29 Jan 1996 04:00:00


| Currently I run a dummy script that sets up the environment
| and then runs the real script, but this is cumbersome
| and slow.
|
| Does anyone know of a way to configure NCSA httpd to
| pass extra environment variables to scripts?  Do other
| servers have this capability?  (I have heard that CERN
| httpd passes the environment it was run under to scripts
| as well as CGI-related variables.)
|
| Any suggestions would be appreciated... I like NCSA httpd,
| so if anyone knows how to do what I need to with it,
| I'd be especially grateful.

Apache lets you do this with an add-on module, but a much better approach
would be to have your scripts source a file that sets up the environment
for you. This could be centrally located so all scripts could use it.

-- Nathan

------------------------------------------------------------
Nathan Neulinger                  Univ. of Missouri - Rolla

WWW: http://www.umr.edu/~nneul      SysAdmin: rollanet.org
WWW: http://pluto.cc.umr.edu      SysAdmin: pluto.cc.umr.edu

 
 
 

Passing non-standard environment variables to CGI scripts

Post by Mike Belsh » Tue, 30 Jan 1996 04:00:00


Quote:> | Currently I run a dummy script that sets up the environment
> | and then runs the real script, but this is cumbersome
> | and slow.
> |
> | Does anyone know of a way to configure NCSA httpd to
> | pass extra environment variables to scripts?  Do other
> | servers have this capability?  (I have heard that CERN
> | httpd passes the environment it was run under to scripts
> | as well as CGI-related variables.)

Netscape servers allow you to do this.

Good luck,

Mike

---
Mike Belshe

 
 
 

Passing non-standard environment variables to CGI scripts

Post by d.. » Sat, 03 Feb 1996 04:00:00


How?

Provide an explanation of how this feature works on Netscape servers. I'm interested in this
too.


 
 
 

1. Hey server gurus... passing environment variables to CGI programs?

Hi, I'm running the following config:
    Server = NCSA 1.4.2
    System = IBM RS/6000 J30
    Op/sys = AIX 4.1.4.0

I start my httpd server from a shell script called /etc/rc.httpd.development
as follows:
------------------------------------------------------------------------------
#!/bin/ksh
#
# rc.httpd.development
#
# 9/29/95  --  kd
#
. /olqdev/.olq_ctl
echo "[ OLQ Development environment set. ]"
echo "[ Starting the NCSA httpd Server Daemon. ]"
echo "  [ Executing /usr/local/ncsa/httpd -d /usr/local/ncsa ]"
/usr/local/ncsa/httpd -d /usr/local/ncsa
echo "  <Complete>"
echo ""
------------------------------------------------------------------------------

As you can see I am running a script called /olqdev/.olq_ctl which set a
whole bunch of environment variables.  I'm sure that these environment
variables are getting passed on to the httpd server, even though he can care
less and does nothing with them.  I made the *assumption* that because the
httpd server spawns all CGI programs that the CGI programs would inherit
the environment from the httpd server, but this does not seem to be the
case.  So question:

    Is there a way to force the httpd server to pass its environment
    variables on to a called CGI program?

The deal is... I'm trying to run a development, beta, and production
environment (which is working quite well for the C code development) and
get the httpd server to participate.  So the brilliant idea came up to
run three separate servers each on their own sockets, with only the
production server listening on socket 80.  In this way, the startup
scripts for each of the servers could pass their needed environment
variables on to the appropriate CGI programs.

Help!!!

--Keith
--
Keith Devlin                "It's too bad I don't smoke any more..."

2. Editor's

3. environment variables passing to another shell (script)

4. Dial-up PPP

5. Passing Client Environment Info to CGI scripts

6. IBM PCI Token-Ring driver

7. Passing variables to a CGI script in SSI

8. Embedded Linux Login Problem ...

9. ?:pass new ENV variables to CGI scripts

10. Setting environment variable for NON-LOGIN scripts

11. Setting up environment variables for CGI scripts run under apache

12. CGI scripts not recognize an Environment Variable

13. environment variable and cgi script