1
votes

I have just set up sqlplus connect to the remote Oracle database and begin to resolve issues with configuring php connection to the same database.

While configuring sqlplus connect , host AVAYAPDSDB was created and used. Right now i was trying to use it in host connection from php and faced to the problem, that appeared to be on this site amoung other users, but not solved or not commented properly.

So. My request is :

$dbh = odbc_connect("DRIVER={Oracle 11g ODBC driver};DSN=AVAYAPDSDB","******","******");

The output in browser trase is that :

Warning: odbc_connect(): SQL error: [unixODBC][Driver Manager]Can't open lib '/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1' : file not found

I double && triple checked is this .so file at this directory or not, and even tried to move it to less deep directory like /usr/lib & /usr/lib64 with changing route to driver in odbcinst.ini but still with no progress.

here is oracle/lib direcrory:

[root@cc-allplus lib]# ls -l
total 187144
-rw-r--r-- 1 root root       368 Aug 24  2013 glogin.sql
-rw-r--r-- 1 root root  53865194 Aug 24  2013 libclntsh.so.11.1
-rw-r--r-- 1 root root   7996693 Aug 24  2013 libnnz11.so
-rw-r--r-- 1 root root   1973074 Aug 24  2013 libocci.so.11.1
-rw-r--r-- 1 root root 118738042 Aug 24  2013 libociei.so
-rw-r--r-- 1 root root    164942 Aug 24  2013 libocijdbc11.so
-rw-r--r-- 1 root root   1502287 Aug 24  2013 libsqlplusic.so
-rw-r--r-- 1 root root   1469542 Aug 24  2013 libsqlplus.so
-rw-r--r-- 1 root root   1003582 Aug 24  2013 libsqora.so.11.1
-rw-r--r-- 1 root root   2091135 Aug 24  2013 ojdbc5.jar
-rw-r--r-- 1 root root   2739616 Aug 24  2013 ojdbc6.jar
-rw-r--r-- 1 root root     66779 Aug 24  2013 xstreams.jar

Here my ldd of this file :

[root@cc-allplus lib]# ldd /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
ldd: warning: you do not have execution permission for `/usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1'
        linux-vdso.so.1 =>  (0x00007fff0ddff000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f25b694b000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f25b66c6000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f25b64a9000)
        libnsl.so.1 => /lib64/libnsl.so.1 (0x00007f25b6290000)
        libclntsh.so.11.1 (0x00007f25b3920000)
        libodbcinst.so.1 => /usr/lib64/libodbcinst.so.1 (0x00007f25b3709000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f25b3375000)
        /lib64/ld-linux-x86-64.so.2 (0x0000003b8fe00000)
        libnnz11.so (0x00007f25b2fa7000)
        libaio.so.1 => /lib64/libaio.so.1 (0x00007f25b2da6000)

In order not to look too confident, here is my odbcinst.ini that works with sqlplus greatly:

[Oracle 11g ODBC driver]
Description     = Oracle ODBC driver for Oracle 11g
Driver          = /usr/lib/oracle/11.2/client64/lib/libsqora.so.11.1
Setup           =
FileUsage       =
CPTimeout       =
CPReuse         =
Driver Logging  = 7

..and odbc.ini :

[AVAYAPDSDB]
Driver = Oracle 11g ODBC driver
DSN = Oracle 11g ODBC driver
ServerName = ccpdsdko
UserID = reporter
Password = reporter

Some people were asking to check if the LD_LIBRARY_PATH was set.. well, mine is set :

[root@cc-allplus lib]# echo $LD_LIBRARY_PATH
:/opt/IBM/informix/lib:/opt/IBM/informix/lib/cli:/opt/IBM/informix/lib/esql:/opt/IBM/informix/lib:/opt/IBM/informix/lib/cli:/opt/IBM/informix/lib/esql:/usr/lib/oracle/11.2/client64/lib/

I would be really thankfull for any help! There are a few posts on this topic on this site, but the last comment in there was dated to 2014.. and issue was not resolved, or not well commented about the solution

1
One peculiarity is this "ldd: warning: you do not have execution permission for". What would happens if you turned the executable bit on all the so files in the oracle directory. Something like chmod ugo+x /usr/lib/oracle/11.2/client64/lib/ Rerun ldd see if the warning disappears and then try launching your app. - Michael Petch
used your command for directory & for .so file . Warning disappeared. php script tells same error. - Altenrion
Do you know what user your php script is running as? It is possible that the path is unavailable (not correct permissions) to allow that user to access the lib directory with oracle? One test might be to log in as the user it runs as and see if you can access the directory at all. As root you can access everything. It is the only reason I can think of that the file can't be found but it is there. - Michael Petch
in phpinfo is written this : User/Group apache(48)/48 . Unfortunatelly i can not get under apache user without turning httpd off...it tels me that apache acount not available - Altenrion
Forget my previous question. Go to this Ubuntu help information and most especially look at Integrate Oracle Libraries and ORACLE_HOME. I would make sure what is suggested there is tried (even if you aren't using Ubuntu - which clearly you aren't, but it may still apply). - Michael Petch

1 Answers

0
votes

Check the SELinux status using the command:

# getenforce

If the answer is Enforcing you can try execute the command:

# setenforce 0

This command is temporary; you will be blocked after system reboot.