This discussion is archived
5 Replies Latest reply: May 11, 2012 4:48 PM by 936842 RSS

libclntsh.so.10.1: cannot open shared object file

936842 Newbie
Currently Being Moderated
Running Redhat EL5.5 with php5.3.13

Installed Oracle instant client basic, sqlplus, and devel 11.2.0.3.0-1

edited .bashrc to include
export ORACLE_HOME=/usr/lib/oracle/11.2/client
export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib
export TNS_ADMIN=/usr/include/oracle/11.2

pecl install oci8

restarted

PHP Warning:  PHP Startup: Unable to load dynamic library '/usr/lib/php/modules/oci8.so' - libclntsh.so.10.1: cannot open shared object file: No such file or directory in Unknown on line 0

Why is it looking for libclntsh.so.10.1?

php -i
ENV["LDLIBRARY_PATH"] => /usr/lib/oracle/11.2/client/lib
_ENV["TNS_ADMIN"] => /usr/include/oracle/11.2
_ENV["ORACLE_HOME"] => /usr/lib/oracle/11.2/client

I checked ld.so.conf and ld.so.conf.d and nothing mentions oracle at all.

sqlplus works just fine so the oracle install appears good, just not loading in php right.
  • 1. Re: libclntsh.so.10.1: cannot open shared object file
    cj Employee ACE
    Currently Being Moderated
    What did you restart? If you meant a web server, then make sure to set the env vars in the script that starts it.
    For example, with the default Apache installation, export LD_LIBRARY_PATH & TNS_ADMIN in /etc/sysconfig/httpd
    You don't need to set ORACLE_HOME when you use Instant Client.

    Instant client doesn't automatically update ld.so.conf so that machines with multiple versions of Oracle don't
    break.
  • 2. Re: libclntsh.so.10.1: cannot open shared object file
    936842 Newbie
    Currently Being Moderated
    By restart I meant the whole server so that the environmental variables are set in .bashrc, etc.

    from phpinfo() Apache Environment includes:
    TNS_ADMIN     /usr/include/oracle/11.2
    LD_LIBRARY_PATH     /usr/lib/oracle/11.2/client/lib
    PHP variables include:
    SERVER["TNSADMIN"]     /usr/include/oracle/11.2
    _SERVER["LD_LIBRARY_PATH"]     /usr/lib/oracle/11.2/client/lib

    So it doesn't look like I need to explicitly state them again in /etc/sysconfig/httpd

    Why is it looking for liblntsh.so.10.1 instead of the installed 11.1 in /usr/lib/oracle/11.2/client/lib?
  • 3. Re: libclntsh.so.10.1: cannot open shared object file
    cj Employee ACE
    Currently Being Moderated
    So it doesn't look like I need to explicitly state them again in /etc/sysconfig/httpd
    Set them in /etc/sysconfig/httpd to ensure the correct values are always picked up.
    Obviously there is some mix of settings on the machine.
    Why is it looking for liblntsh.so.10.1 instead of the installed 11.1 in /usr/lib/oracle/11.2/client/lib?
    Do you have an Oracle 10 installation on your machine? Was OCI8 linked with it?
  • 4. Re: libclntsh.so.10.1: cannot open shared object file
    936842 Newbie
    Currently Being Moderated
    Removed all copies oci8.so (found 4) then reinstalled (pecl install oci8) now get a new error. PHP Warning: PHP Startup: oci8: Unable to initialize module\nModule compiled with module API=20060613\nPHP compiled with module API=20090626\nThese options need to match\n in Unknown on line 0

    Looks like its a PHP issue now, thanks.
  • 5. Re: libclntsh.so.10.1: cannot open shared object file
    cj Employee ACE
    Currently Being Moderated
    Sounds like you also have multiple PHP versions on the machine

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points