[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: GNUstep tool as Apache CGI
From: |
Pascal Bourguignon |
Subject: |
Re: GNUstep tool as Apache CGI |
Date: |
Tue, 3 Dec 2002 19:27:23 +0100 |
Nicola Pero writes:
>
> > Hi all,
> >
> > I am trying to use a GNUstep tool (Objective-C program) called "Adaptor"
> > as a CGI for Apache. The code works great on MacOSX. The GNUstep version
> > also works if called directly in a shell or from a wrapper script
> >
> > #!/bin/sh
> > . /opt/GNUstep/System/Makefiles/GNUstep.sh
> > Adaptor
> >
> > However I would like to avoid the wrapper script for performance reasons
> > and call the CGI directly like
> >
> > http://merkur/cgi-bin/Adaptor
> >
> > This currently does not work. Obviously the tool is not even startet
> > since stuff that is configured in GNUstep.sh is missing. How can I cause
> > Apache to call ". /opt/GNUstep/System/Makefiles/GNUstep.sh" beore
> > starting my CGI?
>
> What about running . /opt/GNUstep/System/Makefiles/GNUstep.sh before
> starting Apache ?
>
> By adding appropriate configuration to Apache, you can then have it pass
> the environment variables you need (presumably the GNUSTEP_*_ROOT) to the
> cgi subprocesses. Those variables would already have been set before you
> start Apache.
Only that IIRC, Apache cleans the environment and set its own
variables for the CGI.
Since speed is important, I would suggest either:
- to set the GNUSTEP variables directly in the wrapper script
instead of running GNUstep.sh each time:
echo '#!/bin/sh' > wrapper
. /opt/GNUstep/System/Makefiles/GNUstep.sh
env | grep GNUSTEP_ | sed -e 's/^/export /' >> wrapper
echo 'Adaptor' >> wrapper
chmod 755 wrapper
- or, to be even more speedy, to set the environment variables
in main() before initializing GNUstep from the tool. (If it
was an application, you'd have to start it directly naming the
binary instead of the script in the application package).
--
__Pascal_Bourguignon__ http://www.informatimago.com/
----------------------------------------------------------------------
There is no worse tyranny than to force a man to pay for what he does not
want merely because you think it would be good for him. -- Robert Heinlein