Hello I have a really simple dockerfile who is the following:
FROM php:8.2-fpm
ARG URL_INSTALL_CLIENT_BASIC='https://download.oracle.com/otn_software/linux/instantclient/2110000/instantclient-basic-linux.x64-21.10.0.0.0dbru.zip'
ARG URL_INSTALL_CLIENT_SDK='https://download.oracle.com/otn_software/linux/instantclient/2110000/instantclient-sdk-linux.x64-21.10.0.0.0dbru.zip'
RUN apt-get update
RUN apt install -y unzip curl
RUN mkdir /opt/oracle
RUN curl ${URL_INSTALL_CLIENT_BASIC} --output /opt/oracle/instantclient-basic-linux.zip
RUN curl ${URL_INSTALL_CLIENT_SDK} --output /opt/oracle/instantclient-sdk-linux.zip
RUN unzip '/opt/oracle/instantclient-basic-linux.zip' -d /opt/oracle
RUN unzip '/opt/oracle/instantclient-sdk-linux.zip' -d /opt/oracle
RUN rm /opt/oracle/instantclient-*.zip
RUN mv /opt/oracle/instantclient_* /opt/oracle/instantclient
RUN docker-php-ext-configure oci8 --with-oci8=instantclient,/opt/oracle/instantclient
RUN docker-php-ext-install oci8
RUN echo /opt/oracle/instantclient/ > /etc/ld.so.conf.d/oracle-insantclient.conf
RUN ldconfig
I have been through the documentation to see how install it. I followed it exactly.
When I build the docker image docker build . -t mytest
no error
but when I check extensions OCI8 is missing docker run mytest:latest php -m
.
I have this nice warning
Warning: PHP Startup: Unable to load dynamic library 'oci8.so' (tried: /usr/local/lib/php/extensions/no-debug-non-zts-20220829/oci8.so (libaio.so.1: cannot open shared object file: No such file or directory), /usr/local/lib/php/extensions/no-debug-non-zts-20220829/oci8.so.so (/usr/local/lib/php/extensions/no-debug-non-zts-20220829/oci8.so.so: cannot open shared object file: No such file or directory)) in Unknown on line 0
[PHP Modules]
Core
ctype
...
do you have any idea what I missed ?
Thank you
PS @Paul W:
The following command docker run mytest:latest ls -la /opt/oracle/instantclient
provide me this result. This is like the lib
folder I guess:
total 245440
drwxr-xr-x 4 root root 4096 Oct 18 12:03 .
drwxr-xr-x 1 root root 4096 Oct 18 12:03 ..
-rw-r--r-- 1 root root 5780 Jun 28 2022 BASIC_LICENSE
-rw-r--r-- 1 root root 1631 Jun 28 2022 BASIC_README
-rw-r--r-- 1 root root 5780 Jun 28 2022 SDK_LICENSE
-rw-rw-r-- 1 root root 1625 Jun 28 2022 SDK_README
-rwxr-xr-x 1 root root 42160 Jun 28 2022 adrci
-rwxr-xr-x 1 root root 59536 Jun 28 2022 genezi
lrwxrwxrwx 1 root root 17 Oct 18 12:03 libclntsh.so -> libclntsh.so.21.1
lrwxrwxrwx 1 root root 17 Oct 18 12:03 libclntsh.so.10.1 -> libclntsh.so.21.1
lrwxrwxrwx 1 root root 17 Oct 18 12:03 libclntsh.so.11.1 -> libclntsh.so.21.1
...
PS2 @Paul W:
what is really weird is if I follow the warning, this file is missing /usr/local/lib/php/extensions/no-debug-non-zts-20220829/oci8.so
but it’ exist and every body can read it ….
But it’s exist :
docker run mytest:latest ls -la /usr/local/lib/php/extensions/no-debug-non-zts-20220829/oci8.so
-rwxr-xr-x 1 root root 192664 Oct 18 12:03 /usr/local/lib/php/extensions/no-debug-non-zts-20220829/oci8.so
2
Answers
I did not see it into the doc, but apparently oracle has more dependencies ...
If I install this the dockerfile now works without warning
libaio1
I’m not very experienced at this but I have a similar setup that I managed to get working for me. If it helps, this is my build:
Note particularly the line:
--with-oci8=shared,instantclient,/usr/lib/oracle/19.9/client64/lib
I suspect you may need the reference to the
lib
dir of the instant client software directory.I also have this to configure it further:
Note the
extension=oci8.so
andextension_dir
variables being set inphp.ini
. That may be worth looking at as well. And lastly, in my configuration of Apache, I have this just before starting up httpd: