install_driver(Oracle) failed: Can’t load `…/DBD/Oracle/’ for module DBD::Oracle


This section is from the "Practical mod_perl " book, by Stas Bekman and Eric Cholet . Also available from Amazon: Practical mod_perl

Here’s an example of the full error report that you might see:

install_driver(Oracle) failed: Can't load
for module DBD::Oracle: cannot open shared object file:
No such file or directory at
/usr/lib/perl5/5.6.1/i386-linux/ line 169.
at (eval 27) line 3
Perhaps a required shared
library or dll isn't installed where expected at
/usr/local/apache/perl/ line 11

On BSD-style filesystems, LD_LIBRARY_PATH is not searched for setuid programs. If Apache is a setuid executable, you might receive this error. Therefore, the first solution is to explicitly load the library from the system-wide ldconfig configuration file:

panic# echo $ORACLE_HOME/lib >> /etc/
panic# ldconfig

Another solution to this problem is to modify the Makefile file (which is created when you run perl Makefile.PL ) as follows:

  1. Search for the line LD_RUN_PATH=

  2. Replace it with LD_RUN_PATH=my_oracle_home/lib

where my_oracle_home is, of course, the home path to your Oracle installation. In particular, the file should exist in the lib subdirectory.

Then just type make install , and all should go well.

Note that setting LD_RUN_PATH has the effect of hardcoding the path to my_oracle_home/lib in the file , which is generated by DBD::Oracle . This is an efficiency mechanism, so that at runtime it doesn’t have to search through LD_LIBRARY_PATH or the default directories used by ld.

For more information, see the ld manpage and the essay on LD_LIBRARY_PATH at .

Perl String Comparison Operators

In order to compare for string equality, or if one string is alphabetically bigger than another, you can use the six string comparison operators. Here are the string operators together with the numerical operators they correspond too:

String Operator Numerical Operator
eq ==
ne !=
gt >
lt <
ge >=
le <=

Notice that the string operators are built from the initials of their abbreviated names. (E.g: eq = equal, gt = greater than). Perl’s string comparison is case-sensitive. If you want a case insensitive string comparison, use the lc function to convert the strings to lowercase beforehand.