Tuesday, January 12, 2010

fighting with oci8 - apache2 + php5 + Oracle

Connecting to the Oracle database by using apache2 + php5 is simple -- if you already know all the traps along the way.

In order to connect to the Oracle database with my apache2 and php5, I've read several tutorials. Many thanks for them.

I want to talk about my experience -- everything is done correctly, but the phpinfo() still shows no oci8 information.

First, you should take a look at the error log of apache in /var/log.
In my case, my error log shows
PHP Warning: PHP Startup: Unable to load dynamic library '/usr/lib/php5/200 60613+lfs/oci8.so' - libaio.so.1: cannot open shared object file: No such fi le or directory in Unknown on line 0

The log already told me the answer, all I had to do is to install the lobaio.so. I did so and solved the problem.

Another way to discover the problem is to use the ldd command to exam the oci8.so.
linux-gate.so.1 => (0xb7fb3000)
libclntsh.so.11.1 => /opt/oracle/instantclient/libclntsh.so.11.1 (0xb627b000)
libc.so.6 => /lib/i686/cmov/libc.so.6 (0xb610e000)
libnnz11.so => /opt/oracle/instantclient/libnnz11.so (0xb5ec0000)
libdl.so.2 => /lib/i686/cmov/libdl.so.2 (0xb5ebc000)
libm.so.6 => /lib/i686/cmov/libm.so.6 (0xb5e96000)
libpthread.so.0 => /lib/i686/cmov/libpthread.so.0 (0xb5e7d000)
libnsl.so.1 => /lib/i686/cmov/libnsl.so.1 (0xb5e64000)
/lib/ld-linux.so.2 (0xb7fb4000)
libaio.so.1 => not found

It showed the same problem.

No comments: