我正试图用php 7.2在ubuntu 18 docker上安装oci8-2.2.0我使用以下命令(php-pear和libc6在此之前安装(:
RUN apt-get update &&
apt-get install -y unzip libaio1 libsnl-dev &&
cd /tmp &&
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip &&
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip &&
wget https://download.oracle.com/otn_software/linux/instantclient/214000/instantclient-basic-linux.x64-21.4.0.0.0dbru.zip &&
mkdir -p /opt/oracle &&
cp instantclient-* /opt/oracle/ &&
cd /opt/oracle/ &&
unzip instantclient-basic-linux.x64-21.4.0.0.0dbru.zip &&
unzip instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip &&
unzip instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip &&
rm -rf /var/lib/apt/lists/* instantclient-basic-linux.x64-21.4.0.0.0dbru.zip instantclient-sdk-linux.x64-21.4.0.0.0dbru.zip instantclient-sqlplus-linux.x64-21.4.0.0.0dbru.zip &&
ln -s /opt/oracle/instantclient_21_4/libclntsh.so.21.1 /usr/lib/libclntsh.so &&
ln -s /lib64/ld-linux-x86-64.so.2 /usr/lib/ld-linux-x86-64.so.2 &&
ln -s /opt/oracle/instantclient_21_4/libnnz21.so /usr/lib/libnnz21.so &&
ln -s /opt/oracle/instantclient_21_4/libclntshcore.so /usr/lib/libclntshcore.so.21.1 &&
echo /opt/oracle/instantclient_21_4 > /etc/ld.so.conf.d/oracle-instantclient.conf
RUN echo "instantclient,/opt/oracle/instantclient_21_4" | pecl install oci8-2.2.0 &&
echo "extension=oci8.so" >> /etc/php/7.2/cli/php.ini &&
echo "extension=oci8.so" >> /etc/php/7.2/apache2/php.ini
PHP似乎可以识别模块并加载它,但当我调用@oci_new_connect时,我没有得到连接,但也没有得到错误。
从同一台服务器使用sqlplus连接得很好,但事实并非如此。管理员4.8.1 docker的另一个安装程序(alpine&php7.4(运行良好。
我完全被难住了。有人知道下一步该去哪里吗?
发现问题,需要添加
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/oracle/instantclient_21_4