Apache RHEL Environment Setup Question (httpd-2.2.3-53.el5_7.1)


I have some Perl scripts that use DBD::Oracle and run fine from command line however if I place them in the CGI-BIN directory and try to access them via the web I get the error below:

Can't load '/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/lib/perl5/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libocci.so.11.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm line 230.

I believe this is due to Apache environment not being setup correclty so my question is how do I setup the ENV in Apache like I do on a user .profile?

export ORACLE_HOME=/usr/lib/oracle/11.2/client64
export TNS_ADMIN=/usr/lib/oracle/11.2/client64/network/admin
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib
export PERL5LIB=/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/lib/perl5/x86_64-linux-thread-multi

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Was your ORACLE_HOME set before/when you compiled it?

Tbone3434Author Commented:
Apache was installed long before Oracle was so no it was not.
Tbone3434Author Commented:
I should also mention that I have the ENV declared in my script already.

$SETENV{ORACLE_HOME} = "/usr/lib/oracle/11.2/client64";

use lib "/usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/lib/perl5/x86_64-linux-thread-multi";
use lib "/usr/lib/perl5/site_perl/5.8.8";
use lib "/usr/lib/oracle/11.2/client64/lib";
Big Business Goals? Which KPIs Will Help You

The most successful MSPs rely on metrics – known as key performance indicators (KPIs) – for making informed decisions that help their businesses thrive, rather than just survive. This eBook provides an overview of the most important KPIs used by top MSPs.


ln -s libocci.so.11.1 libocci.so

Also, what do you get when you run:

ls -l /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thread-multi/lib/perl5/x86_64-linux-thread-multi/auto/DBD/Oracle/Oracle.so


sed -n '230p' /usr/lib64/perl5/5.8.8/x86_64-linux-thread-multi/DynaLoader.pm
Tbone3434Author Commented:
Thanks for the assistance digus.  I ended up declaring them in httpd.conf.  Did an Apache restart and it worked.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Tbone3434Author Commented:
I was able to figure out the issue
Can you post the actual apache declaration statements then? Otherwise, the question is not technically "solved", as far as the EE community is concerned.

Tbone3434Author Commented:
This is exactly what I added to  httpd.conf to resolve the issue.

# Environment variables
SetEnv ORACLE_HOME /usr/lib/oracle/11.2/client64
SetEnv LD_LIBRARY_PATH /usr/lib/oracle/11.2/client64/lib
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Apache Web Server

From novice to tech pro — start learning today.