下载套件

#!/bin/bash

#https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
#http://www.jiangjun.name/experience/49
#https://blog.csdn.net/MoreEfforts/article/details/78281637
wget https://download.oracle.com/otn_software/linux/instantclient/215000/oracle-instantclient-devel-21.5.0.0.0-1.x86_64.rpm
wget https://download.oracle.com/otn_software/linux/instantclient/215000/oracle-instantclient-sqlplus-21.5.0.0.0-1.x86_64.rpm
wget https://download.oracle.com/otn_software/linux/instantclient/215000/oracle-instantclient-basic-21.5.0.0.0-1.x86_64.rpm

安装套件

apt update
apt install alien
apt install libaio1
alien -i oracle-instantclient-basic-21.5.0.0.0-1.x86_64.rpm
alien -i oracle-instantclient-devel-21.5.0.0.0-1.x86_64.rpm
alien -i oracle-instantclient-sqlplus-21.5.0.0.0-1.x86_64.rpm

安装Oracle驱动

wget https://pecl.php.net/get/oci8-2.2.0.tgz
tar -zxvf oci8-2.2.0.tgz
cd oci8-2.2.0
/usr/bin/phpize
./configure --with-php-config=/usr/local/php/bin/php-config --with-oci8=shared,instantclient,/usr/lib/oracle/21/client64/lib
make
make test
make install

参考链接

#https://stackoverflow.com/questions/37191161/install-pdo-oci-on-php7
#https://blog.csdn.net/gmac1/article/details/74586735
#https://www.leocode.net/article/index/34.html
#https://blog.csdn.net/weixin_34072159/article/details/91666606
#https://www.php.net/pdo-oci

PHP驱动安装

PHP_VERSION=7.4.3 # Set to your PHP version
cd /tmp
sudo apt-get install php-dev -y
wget https://www.php.net/distributions/php-${PHP_VERSION}.tar.gz
tar xvfj php-${PHP_VERSION}.tar.gz
rm php-${PHP_VERSION}.tar.gz
cp -r /tmp/php-${PHP_VERSION}/ext/pdo_oci /tmp
cd /tmp/pdo_oci
export ORACLE_HOME=/usr/lib/oracle/21/client64
phpize
#./configure --enable-option-checking=fatal # Optionally add more parameters
./configure --with-php-config=/usr/local/php/bin/php-config --with-pdo-oci
make
make install


Thank you for using 苹果树. | 粤ICP备18042975号-1