phpdockeroci8

Unable to load dynamic library 'oci8.so' (PHP 7.2)


Since the update of PHP 7.1 to PHP 7.2 I can't install oci8. I have this error:

root@3ab6027c8d95:/var/www# php -v

PHP Warning: PHP Startup: Unable to load dynamic library 'oci8.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/oci8.so (libmql1.so: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20170718/oci8.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20170718/oci8.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0

PHP 7.2.0 (cli) (built: Dec 12 2017 05:52:58) ( NTS ) Copyright (c) 1997-2017 The PHP Group Zend Engine v3.2.0, Copyright (c) 1998-2017 Zend Technologies with Zend OPcache v7.2.0, Copyright (c) 1999-2017, by Zend Technologies

I'm using Docker environment, I created a github repo for this, it works if I use the version 7.1 of PHP (shenron/docker-php-fpm:7.2).

I don't understand why the script try to launch this file: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/oci8.so.so.

To my point of view there are two possibilities; or the driver is not compatible, or pecl can't today install oci8.

Has anyone the same problem ?

Thank you for your help.


Solution

  • /usr/local/lib/php/extensions/no-debug-non-zts-20170718/oci8.so.so is only the second guess on the shared library file name. You can safely ignore that.

    The actual problem is: (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20170718/oci8.so (libmql1.so: cannot open shared object file: No such file or directory)

    oci8.so itself depends on multiple shared libraries, you can use ldd to find out which ones:

    ldd /usr/local/lib/php/extensions/no-debug-non-zts-20170718/oci8.so
        linux-vdso.so.1 (0x00007ffc8bfe7000)
        libclntsh.so.12.1 => /usr/local/instantclient/libclntsh.so.12.1 (0x00007fb9919e0000)
        libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fb991641000)
        libmql1.so => not found
        libipc1.so => not found
        libnnz12.so => not found
        libons.so => not found
        libdl.so.2 => /lib/x86_64-linux-gnu/libdl.so.2 (0x00007fb99143d000)
        libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fb991139000)
        libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007fb990f1c000)
        libnsl.so.1 => /lib/x86_64-linux-gnu/libnsl.so.1 (0x00007fb990d04000)
        librt.so.1 => /lib/x86_64-linux-gnu/librt.so.1 (0x00007fb990afc000)
        /lib64/ld-linux-x86-64.so.2 (0x00007fb994bc8000)
        libaio.so.1 => /lib/x86_64-linux-gnu/libaio.so.1 (0x00007fb9908fa000)
        libclntshcore.so.12.1 => not found
    

    Those .so files seem to be part of a zip file in your repository. Running PHP like this LD_LIBRARY_PATH=/usr/local/instantclient_12_1/ php works fine inside your container. You need to move those so files to a sane location.