oracle 在docker上安装php OCI8

vecaoik1  于 2023-11-17  发布在  Oracle
关注(0)|答案(1)|浏览(140)

你好,我有一个非常简单的dockerfile,如下所示:

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

字符串
我已经看过文档,看看如何安装它。我完全按照它。
当我构建Docker镜像docker build . -t mytest时没有错误
但是当我检查扩展名时,OCI 8丢失了docker run mytest:latest php -m
我有个善意的警告

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
...


你知道我错过了什么吗
谢谢你
PS @Paul W:下面的命令docker run mytest:latest ls -la /opt/oracle/instantclient为我提供了这个结果。我猜这就像lib文件夹:

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
...


什么是真正奇怪的是,如果我按照警告,这个文件是失踪的/usr/local/lib/php/extensions/no-debug-non-zts-20220829/oci8.so,但它的存在,每个人都可以阅读它。
但它是存在的:

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

w8rqjzmb

w8rqjzmb1#

我没有看到它进入文档,但显然甲骨文有更多的依赖.
如果我安装了这个,dockerfile现在可以在没有警告的情况下工作。
第一个月

FROM php:8.2-fpm

ARG URL_INSTALL_CLIENT_BASIC='https://download.oracle.com/otn_software/linux/instantclient/217000/instantclient-basic-linux.x64-21.7.0.0.0dbru.zip'
ARG URL_INSTALL_CLIENT_SDK='https://download.oracle.com/otn_software/linux/instantclient/217000/instantclient-sdk-linux.x64-21.7.0.0.0dbru.zip'

RUN apt-get update

RUN apt install -y unzip curl libaio1

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

字符串

相关问题