Rootop 服务器运维与web架构

安装oci8和pdo_oci扩展

下载依赖:
https://www.oracle.com/database/technologies/instant-client/linux-x86-64-downloads.html
oracle-instantclient11.1-devel-11.1.0.7.0-1.x86_64.rpm
oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64.rpm
把2个rpm包安装上。

php版本7.4.20,去官网下载相同版本源码。

进ext目录:

[root@MiWiFi-RA69-srv ext]# ll -d oci8 pdo_oci
drwxrwxr-x 8 root root 4096 Jul 14 10:01 oci8
drwxrwxr-x 3 root root  175 Jun  1 23:41 pdo_oci

oci8和pdo_oci都是php oracle的扩展。

安装pdo_oci:

[root@MiWiFi-RA69-srv pdo_oci]# /www/server/php/74/bin/phpize 
[root@MiWiFi-RA69-srv pdo_oci]# ./configure  --with-php-config=/www/server/php/74/bin/php-config
checking if that is sane... configure: error: You need to tell me where to find your Oracle Instant Client SDK, or set ORACLE_HOME.

[root@MiWiFi-RA69-srv pdo_oci]# rpm -ql oracle-instantclient11.1-basic-11.1.0.7.0-1.x86_64
/usr/lib/oracle/11.1/client64/bin/adrci
/usr/lib/oracle/11.1/client64/bin/genezi
/usr/lib/oracle/11.1/client64/lib/libclntsh.so.11.1
/usr/lib/oracle/11.1/client64/lib/libnnz11.so
/usr/lib/oracle/11.1/client64/lib/libocci.so.11.1
/usr/lib/oracle/11.1/client64/lib/libociei.so
/usr/lib/oracle/11.1/client64/lib/libocijdbc11.so
/usr/lib/oracle/11.1/client64/lib/ojdbc5.jar
/usr/lib/oracle/11.1/client64/lib/ojdbc6.jar

[root@MiWiFi-RA69-srv pdo_oci]# ./configure --help
  --with-pdo-oci[=DIR]    PDO: Oracle OCI support. DIR defaults to
                          $ORACLE_HOME. Use
                          --with-pdo-oci=instantclient,/path/to/instant/client/lib
[root@MiWiFi-RA69-srv pdo_oci]# ./configure  --with-php-config=/www/server/php/74/bin/php-config --with-pdo-oci=instantclient,/usr/lib/oracle/11.1/client64/lib
[root@MiWiFi-RA69-srv pdo_oci]# make && make install

安装oci8:

[root@MiWiFi-RA69-srv oci8]# /www/server/php/74/bin/phpize 
[root@MiWiFi-RA69-srv pdo_oci]# ./configure  --with-php-config=/www/server/php/74/bin/php-config
[root@MiWiFi-RA69-srv pdo_oci]# make && make install

配置php.ini加载模块:

extension=/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/pdo_oci.so
extension=/www/server/php/74/lib/php/extensions/no-debug-non-zts-20190902/oci8.so

重启php。

[root@MiWiFi-RA69-srv ext]# /www/server/php/74/bin/php -m | grep -E "oci|OCI"
oci8
PDO_OCI

原创文章,转载请注明。本文链接地址: https://www.rootop.org/pages/4977.html

作者:Venus

服务器运维与性能优化

评论已关闭。