2
votes

I have a problem oci8 module not loaded.

The OS is Ubuntu 16, with Apache 2.4 and PHP 5.6

I do the following steps:

  • I Downloaded Oracle Instant Client Basic and SDK packages: ( oracle-instantclient11.2-basic-11.2.0.4.0-1.x86_64.rpm, oracle-instantclient11.2-devel-11.2.0.4.0-1.x86_64.rpm )
  • Install the Oracle Instant Client (after converting the .rpm to .deb)
  • Download the OCI8 Extension from PECL ( oci8-2.0.12 )
  • Build the PHP OCI8 Module
  • Copy oci8.so to modules directory (/usr/lib/php/20131226/)
  • Edit php.ini file and adding extension with full path (extension=/usr/lib/php/20131226/oci8.so)
  • I added the oracle library path to the environment variable LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib
  • Restart Apache

The module not loaded and Apache logs showing the following error:

Unable to load dynamic library '/usr/lib/php/20131226/oci8.so' - libaio.so.1: cannot open shared object file: No such file or directory in Unknown on line 0

2
Can your process access to the file oci8.so ? Are attributes of chmod good ?Alexandre Tranchant
Thank you @Alexandre T, I think it's attributes like other php modules, -rwxr-xr-x 1 root root 624416 Dec 3 15:42 oci8.so for ex. -rw-r--r-- 1 root root 1463904 Nov 14 05:35 mbstring.so -rw-r--r-- 1 root root 47256 Nov 14 05:35 mcrypt.so -rw-r--r-- 1 root root 55432 Nov 14 05:35 mysql.soAhmad Abdullah
What happens if you remove the executable flag ? chmod a-x oci8.so Does bug still persist ?Alexandre Tranchant
What's the result of $ locate libaio.so ? Is it corresponding to LD_LIBRARY_PATHAlexandre Tranchant
Thank you very much @Alexandre T, The locate command shows empty result, I try sudo apt-get install libaio1, and the problem solved.Ahmad Abdullah

2 Answers

2
votes

The problem was from libaio.so library as @Alexandre mentioned, It's a 32/64 bit mismatch.

I found the problem from @Codo answer: https://stackoverflow.com/a/10619763/1995358

The problem solved after installing libaio.so library again:

sudo apt-get install libaio1

1
votes

Make sure LD_LIBRARY_PATH is set where Apache finds it, possibly Apache's envvars file. Or you could update ldconfig if you don't have any other Oracle software on the machine. There's plenty of info in the free Underground PHP & Oracle Manual

A couple of questions: Why not use the 12.1 Instant Client? With this, you can connect to Oracle DB 10.2 and later.

Also why did you convert the RPMs and then move the output to a user directory? Why not simply download the Instant Client zip files and unzip them? All you need to do is add the sym link mentioned on the download page instructions.