Setting envars for use by CGI applets

software development

#1

How could I set environmental variables to be used by CGI applets run by Apache?

While my immediate interest is in modifying the perl search path for modules, I imagine there are other reasons one would do this sort of thing.

Seems to me that editing .bashrc would only work if I were executing perl from the command line…


#2

This guide should help you:

http://knowledgebase.iplanet.com/ikb/kb/articles/387.html

May I ask why do you want to do this?


Wiliam Stephens <wil@stephens.org>


#3

I didn’t realize that Dreamhost was offering boxes with the Netscape 2.0 server on it. The box my account runs on has Apache.

As I indicated, what I had in mind was changing the path that Perl uses to search for modules. You know, like adding a directory located within my account so Perl could find any modules I might put there?

Someone else replied by email, though. Turns out SETENV works in .htaccess after all. I had previously been told that it HAD to go in httpd.conf (which is something I’d hope Dreamhost would be careful about letting customers screw with).


#4

Why do you want to fiddle with the ENV Variables? Just add a simple use lib; statement at the beginning of your Perl scripts (before you require or use your modules) and Perl will know to go looking in that directory as well as the default ones.

use lib ("/path/to/local/modules");… should do the trick.


Wiliam Stephens <wil@stephens.org>