[kw-pm] Perl CGIs, modules and Apache.

Daniel R. Allen daniel at coder.com
Fri Apr 2 21:56:05 CST 2004


On Fri, 2 Apr 2004, Christopher Calzonetti wrote:

> As for which user apache runs as, it runs under user www, which doesn't
> have a shell to speak of.  The user information has the shell set to
> /usr/bin/false.

Ah- but the user still has environment variables.  You can run things
effectivly as the webserver by:

su to root
su - www

and you can run your cgis from the command-line with the same permissions
as the webserver.  Useful for diagnosing environment problems.

...and if you do this (he said, guessing...) perl -V will tell you that
www's PERL5LIB is missing the directories you added to your own PERL5LIB.

You can fix that by modifying the script that starts apache to load the
environment variable into the parent shell.  But when I tried this now, I
couldn't get it to work properly.

What did work like a charm was adding this to apache's httpd.conf, which
loads the environment variable directly into apache:

LoadModule env_module /usr/lib/apache/1.3/mod_env.so
SetEnv PERL5LIB /home/daniel/work/foo

Hope that helps.

--
http://coder.com/ - Prescient Code Solutions - (519) 575-3733 da at coder.com




More information about the kw-pm mailing list