1

I am running Apache on Centos 7.

Some of the Perl modules that were not available via yum I have installed using CPAN in the custom location /export/home/www/perl5. I have used this custom location specifically to prevent the CPAN modules from interfering with anything installed by yum, or vice versa.

I then put this in my .bashrc:

export PERL_LOCAL_LIB_ROOT="$PERL_LOCAL_LIB_ROOT:/export/home/www/perl5";
export PERL_MB_OPT="--install_base /export/home/www/perl5";
export PERL_MM_OPT="INSTALL_BASE=/export/home/www/perl5";
export PERL5LIB="/export/home/www/perl5/lib/perl5:$PERL5LIB";
export PATH="/export/home/www/perl5/bin:$PATH";

That worked great for running a locally built Apache, but when I try to run the Apache2 that comes with yum, I get this:

[Mon Jun 27 19:35:34.099272 2016] [perl:error] [pid 29077] Can't locate Apache/DBI.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 . /etc/httpd) at (eval 3) line 2.\n

So the custom path has not been added to @INC for this Apache. I assume it isn't running from within my shell.

How do I get Apache to add this perl path?

  • What happens if you add use lib /export/home/www/perl5 to your cgi script? Or if you add SetEnv PERL5LIB /export/home/www/perl5 to your apache config and restart apache? – Aaron Jun 27 '16 at 20:54
  • or use lib qw('/export/home/www/perl5'); in the cgi script. I suppose it depends on which behavior you want changed. SetEnv PERL5LIB /export/home/www/perl5 will add that for everyone using that server. – Aaron Jun 27 '16 at 21:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.