Reputation: 1
When trying to run a perl script that creates a new oracle database from a PHP web page, an error is raised.
Updated the following environment variables:
export ORACLE_HOME=oracle home path
export LD_LIBRARY_PATH=$ORACLE_HOME/lib
export PATH=$ORACLE_HOME/bin:$PATH
The perl tool is executed from PHP code after clicking on a HTML button:
exec("perl scriptName.pl" )
The following error is raised:
install_driver(Oracle) failed: Can't load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.12.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190. at (eval 17) line 3. Compilation failed in require at (eval 17) line 3. Perhaps a required shared library or dll isn't installed where expected at (eval 10) line 22698.
Even though running the perl script alone without calling from web php page by executing: "perl script.pl"
on the linux server, the code executed and no errors raised.
Upvotes: 0
Views: 10367
Reputation: 10529
Actually, the error message contains the important pointer (emphasis mine):
install_driver(Oracle) failed: Can't load '/usr/local/lib64/perl5/auto/DBD/Oracle/Oracle.so' for module DBD::Oracle: libclntsh.so.12.1: cannot open shared object file: No such file or directory at /usr/lib64/perl5/DynaLoader.pm line 190. at (eval 17) line 3. Compilation failed in require at (eval 17) line 3. Perhaps a required shared library or dll isn't installed where expected at (eval 10) line 22698.
This problem arises when Oracle's "instant client" libraries are not available via the LD_LIBRARY_PATH
environment variable. This set of libraries contains (among others) libclntsh.so
(the suffix is version-dependant). Once you have it installed, just make sure the corresponding path is present in LD_LIBRARY_PATH
.
Upvotes: 1