ps:例子是php7
1.安装oracle组件
下载:http://www.oracle.com/technetwor ... -64soft-092277.html
注册账号:
oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
PS: 两个都必须安装,devel版本就是SDK
2.安装
- rpm -i oracle-instantclient12.2-basic-12.2.0.1.0-1.x86_64.rpm
- rpm -i oracle-instantclient12.2-devel-12.2.0.1.0-1.x86_64.rpm
复制代码
软连接下
- ln -s /usr/lib/oracle/12.2 /usr/lib/oracle/10.2.0.1
- ln -s /usr/include/oracle/12.2 /usr/include/oracle/10.2.0.1
复制代码
3.添加配置项目
最后加入:
- export ORACLE_HOME=/usr/lib/oracle/12.2/client64
- export LD_LIBRARY_PATH=/usr/lib/oracle/12.2/client64/lib
- export NLS_LANG="AMERICAN_AMERICA.AL32UTF8" //具体字符集根据服务端来
复制代码
执行生效:
3.编译安装oci8
下载:http://pecl.php.net/package/oci8
- wget http://pecl.php.net/get/oci8-2.1.8.tgz
复制代码
解压安装
- tar -zxf oci8-2.1.8.tgz
- cd oci8-2.1.8
- /www/server/php/70/bin/phpize
- ./configure --with-php-config=/www/server/php/70/bin/php-config --with-oci8=shared,instantclient,/usr/lib/oracle/12.2/client64/lib
- make
- make install
复制代码
备注:phpize和php-config 根据实际php安装路径来哦
4.编译安装pdo_oci
升级re2c 不升级有警告错误
下载php源码包
- wget https://www.php.net/distributions/php-7.0.33.tar.gz
复制代码
解压并进入pdo_oci目录
- tar -zvxf php-7.0.33.tar.gz
- cd php-7.0.33/ext/pdo_oci/
- phpize
- ./configure --with-php-config=/www/server/php/70/bin/php-config --with-pdo-oci=instantclient,/usr,10.2.0.1
- make
- make install
复制代码
php-config 根据实际php安装路径来哦
5.php.ini添加扩展
- extension=oci8.so
- extension=pdo_oci.so
复制代码
6.重启php 看探针 有了 完成
|