3

I have a problem with the oci8 module, it doesn't load.

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 )
  • Installed the Oracle Instant Client (after converting the .rpm to .deb)
  • Downloaded the OCI8 Extension from PECL ( oci8-2.0.12 )
  • Built the PHP OCI8 Module
  • Copied oci8.so to modules directory (/usr/lib/php/20131226/)
  • Edited php.ini file and adding extension with full path (extension=/usr/lib/php/20131226/oci8.so)
  • Added the oracle library path to the environment variable LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client/lib
  • Then, Restarted Apache web server

The module is not loaded and Apache logs show 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

Ahmad Abdullah
  • 1,645
  • 1
  • 16
  • 25
  • 1
    Can your process access to the file oci8.so ? Are attributes of chmod good ? – Alexandre Tranchant Dec 04 '16 at 10:11
  • 1
    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.so` – Ahmad Abdullah Dec 04 '16 at 10:24
  • 1
    What happens if you remove the executable flag ? `chmod a-x oci8.so` Does bug still persist ? – Alexandre Tranchant Dec 04 '16 at 13:11
  • 1
    What's the result of `$ locate libaio.so` ? Is it corresponding to `LD_LIBRARY_PATH` – Alexandre Tranchant Dec 04 '16 at 14:48
  • 1
    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 Dec 04 '16 at 15:19

3 Answers3

3

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

Ahmad Abdullah
  • 1,645
  • 1
  • 16
  • 25
1

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.

Christopher Jones
  • 9,449
  • 3
  • 24
  • 48
0

I created the file etc/apache/envvars In that, I wrote: export LD_LIBRARY_PATH=/usr/lib/oracle/11.2/client64/lib export ORACLE_HOME=/usr/lib/oracle/11.2/client64

Then, it`s important, how the apache is restared (a systemctl restart did not work in my case). I did: apache2ctl stop apache2ctl start

...and everything was fine.

Kai Behncke
  • 129
  • 1
  • 7