[Chicago-talk] mod_perl config help

Siddhartha Basu sidd.basu at gmail.com
Tue Jan 27 08:41:19 PST 2009


Hi,
I am trying to source some environmental variables for my web app
through mod_perl2 and apache2. Here are my configs ....

The legacy conf file looks like this(bunch of bash export calls) ....

-------------------
export LD_LIBRARY_PATH=/usr/local/instantclient_10_2
export SITE_NAME=dictyBaseDP
export BLAST_PORT=8080
export BLAST_SERVER_USER=ubuntu
export IDENTIFIER_PREFIX=DPU
export ORGANISM_GENUS=Dictyostelium
------------------------------

The relevant apache config section ......


<Perl>
       use File::Spec::Functions;
       use IO::File;
       use Apache2::PerlSections;


       $Apache2::PerlSections::Save = 1;
       my $s = Apache2::PerlSections->server();


        my $conf_file = catfile('/etc','apache2','conf.d,'conf.sh');
       my $handler = IO::File->new($conf_file,'r') ;
       while (my $line = $handler->getline()) {
               chomp $line;
               if ($line =~ /export\s+(\w+)=(.+)/) {
                       $s->add_config(["PerlSetEnv $1 $2"]);
               }
       }
       $handler->close();
</Perl>

However, starting apache throws error ....
Syntax error on line 49 of
/etc/apache2/sites-enabled/mod_dictyBaseDP.conf:
\t(in cleanup) $s->add_config() has failed: PerlSetEnv takes two
arguments, PerlSetEnv at /etc/apache2/sites-enabled/mod_dictyBaseDP.conf
line 63, <GEN0> line 53.\n
   ...fail!

It works with 'PerlPassEnv' argument,
$s->add_config(["PerlPassEnv $1"]);

I need to pass key => value option so 'PerlPassEnv' is not suitable for
me. So, any idea why it is failing on 'PassSetEnv'.

-siddhartha 




More information about the Chicago-talk mailing list