How to pass environment variables to cgi executables

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
xpt
Forum Newbie
Posts: 23
Joined: Tue Feb 20, 2007 1:00 pm

How to pass environment variables to cgi executables

Post by xpt »

Hi,

Is there any way to pass environment variables to cgi executables?

I want to set up proper LD_LIBRARY_PATH environment variables before
invoking the cgi executables.

Here is my cgi executables, and how I plan to call it.

Code: Select all

$ file omega
 omega: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), for GNU/Linux 2.4.1, dynamically linked (uses shared libs), not stripped

 <FORM NAME=P METHOD=GET ACTION="omega">
Please help.

FYI. If you need further details, you can check out the background for the request at http://article.gmane.org/gmane.comp.sea ... neral/4704

Thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

If you're using an apache server and you want to set this environment variable only for the cgi you might be interested in the SetEnv directive.
xpt
Forum Newbie
Posts: 23
Joined: Tue Feb 20, 2007 1:00 pm

Post by xpt »

volka wrote:If you're using an apache server and you want to set this environment variable only for the cgi you might be interested in the SetEnv directive.
thanks for the info.
Environment variables may be passed from the shell which invoked the httpd process.
seems to me that is for how to setup Environment variables for the httpd, ie, whole site and cgis, not a single CGI.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

That you can do with all processes in all shells that support the feature like e.g. bash
http://www.gnu.org/software/bash/manual/bashref.html#SEC51 wrote:The environment for any simple command or function may be augmented temporarily by prefixing it with parameter assignments, as described in 3.4 Shell Parameters. These assignment statements affect only the environment seen by that command.
Post Reply