Httpd – Apache environment variables for CGI not setting

apache-2.2environment-variableshttpdperl

I am trying to set my environment variables for the Apache webserver as it is not the correct Perl package. I followed the recommendation of one of the answers on Server Fault for updating the httpd file and adding the environment variables and it still isn't working. After I updated the httpd file I bounced the httpd process as well. On the command line the correct PATH is being used for Perl. Can anyone offer any guidance?

Error in apache error.log file:

[pid 29460] [client 10.199.106.141:57768] AH01215: install_driver(Informix) failed: Can't locate DBD/Informix.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 .) at (eval 7)

The correct location of Perl where Apache should check for Perl Modules

/usr/bin/perl

Updated /etc/sysconfig/httpd file

#Configuration of variables for webserver

export INFORMIXDIR=/opt/informix

export    LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$INFORMIXDIR/lib:$INFORMIXDIR/lib/cli:$INFORMIXDIR/lib/esql:$INFORMIXDIR/lib/tools

export INFORMIXSQLHOSTS=$INFORMIXDIR/etc/sqlhosts

PATH=$PATH:$HOME/bin:$INFORMIXDIR/bin:$LD_LIBRARY_PATH

export PATH

Other environment variables

OS Package:  Apache/2.4.6 (Red Hat Enterprise Linux) PHP/5.4.16
CONTEXT_DOCUMENT_ROOT = /var/www/cgi-bin/

Best Answer

Your error

Can't locate DBD/Informix.pm in @INC

means that it is missing the Perl module DBD::Informix. There are a variety of options for getting this module:

  1. on Red Hat, or systems: yum install perl-DBD-Informix
  2. on Debian or Ubuntu: apt-get install libdbd-informix-perl
  3. using cpanminus to create a local library: cpanm DBD::Informix
  4. using CPAN.pm

If you've been installing things from your distribution generally it is good to continue to do that, but otherwise one of the more Perl-specific methods (cpanminus or CPAN.pm) will probably give you something that works.