php 增加 拓展 oci8 - 支持oracle数据库

2024/03 作者:ihunter 0 0


docker exec -it php81 /bin/bash


#oracle client

https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html

-Base

wget  https://download.oracle.com/otn_software/linux/instantclient/2113000/instantclient-basic-linux.x64-21.13.0.0.0dbru.zip

-Tools

wget  https://download.oracle.com/otn_software/linux/instantclient/2113000/instantclient-sqlplus-linux.x64-21.13.0.0.0dbru.zip

-Development and Runtime

https://download.oracle.com/otn_software/linux/instantclient/2113000/instantclient-sdk-linux.x64-21.13.0.0.0dbru.zip

unzip  instantclient-basic-linux.x64-21.13.0.0.0dbru.zip

unzip  instantclient-sqlplus-linux.x64-21.13.0.0.0dbru.zip

unzip  instantclient-sdk-linux.x64-21.13.0.0.0dbru.zip


mv  instantclient_21_13  /usr/local/opt/

apt-get install build-essential libaio1

ln -s  libclntsh.so.21.1 libclntsh.so

ln -s  libnnz21.so   libnnz.so

ln -s  libclntshcore.so.21.1 libclntshcore.so

docker-php-ext-configure oci8 --with-oci8=instantclient,/usr/local/opt/instantclient_21_13

docker-php-ext-install oci8 

echo /usr/local/opt/instantclient_21_13 > /etc/ld.so.conf.d/oracle-instantclient

ldconfig


-PHP 7

pecl install oci8-2.2.0

-PHP 8.0

pecl install oci8-3.0.1

-PHP 8.1

pecl install oci8-3.2.1

-PHP 8.2

pecl install oci8


-Oracle instant client library

instantclient,/usr/local/opt/instantclient_21_13


echo extension=oci8 > /usr/local/etc/php/conf.d/docker-php-ext-oci8.ini


-Unable to load dynamic library 'oci8.so'

ldd  /usr/local/lib/php/extensions/no-debug-non-zts-20210902/oci8.so

cp /usr/local/opt/instantclient_21_13/libnnz21.so  /lib/x86_64-linux-gnu/

cp /usr/local/opt/instantclient_21_13/libclntshcore.so.21.1  /lib/x86_64-linux-gnu/


apt-get install -y  libnsl*

docker-php-ext-enable oci8

-对于PHP PDO连接Oracle数据库查询中文乱码问题

vim  /usr/local/etc/php-fpm.d/www.conf

在最后一行新增: 

env[NLS_LANG]=AMERICAN_AMERICA.AL32UTF8



赞(0) 更多分享

上篇: 推进网络安全保护工作 2022年建成医保网络安全体系
下篇: 没有了