首页 > 解决方案 > 在 CentOS Linux release 7.2.1511 (Core) 中安装 Php 7.4.1、oracleclient 和 oci8

问题描述

我正在尝试安装 PHP 7.4.1、oracleclient 和 oci8 以实现 oracle 连接。我在各种论坛上尝试了所有可能的解决方案,但没有运气。系统:CentOS Linux release 7.2.1511 (Core)

[root@localhost ~]# rpm -qa|grep php
php-common-7.4.10-1.el7.remi.x86_64
php-pecl-mcrypt-1.0.3-1.el7.remi.7.4.x86_64
php-process-7.4.10-1.el7.remi.x86_64
php-opcache-7.4.10-1.el7.remi.x86_64
php-xml-7.4.10-1.el7.remi.x86_64
php-devel-7.4.10-1.el7.remi.x86_64
php-sodium-7.4.10-1.el7.remi.x86_64
php-pdo-7.4.10-1.el7.remi.x86_64
php-pear-1.10.12-2.el7.remi.noarch
php-cli-7.4.10-1.el7.remi.x86_64
php-mysqlnd-7.4.10-1.el7.remi.x86_64
php-json-7.4.10-1.el7.remi.x86_64
php-gd-7.4.10-1.el7.remi.x86_64
php-oci8-7.4.10-1.el7.remi.x86_64
php-fedora-autoloader-1.0.1-2.el7.noarch
php-7.4.10-1.el7.remi.x86_64
[root@localhost ~]# 


[root@localhost ~]# rpm -qa|grep oracle
oracle-instantclient18.3-sqlplus-18.3.0.0.0-3.x86_64
oracle-instantclient18.3-basic-18.3.0.0.0-3.x86_64
oracle-instantclient18.3-jdbc-18.3.0.0.0-3.x86_64
oracle-instantclient18.3-devel-18.3.0.0.0-3.x86_64
[root@localhost ~]# 

[root@localhost ~]# vi .bash_profile

.bash_profile

获取别名和函数

如果 [ -f ~/.bashrc ]; 然后 。~/.bashrc 文件

用户特定环境和启动程序

PATH=$PATH:$HOME/bin

导出路径

[root@localhost ~]# vi .bashrc vi .bashrc
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
ORACLE_HOME=/usr/lib/oracle/18.3/client64
export ORACLE_HOME




[root@localhost ~]# vi .bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs

PATH=$PATH:$HOME/bin

export PATH
ORACLE_HOME=/usr/lib/oracle/18.3/client64
export ORACLE_HOME

我是系统的初学者。任何帮助深表感谢

标签: phplinuxcentos7oci8oracleclient

解决方案


使用我的存储库,您需要最新的 Oracle 客户端库版本19.8(不是 18.3)

$ rpm -qi php-oci8
...
The php-oci8 packages provides the OCI8 extension version 2.2.0
and the PDO driver to access Oracle Database.

The extension is linked with Oracle client libraries 19.8
(Oracle Instant Client).  For details, see Oracle's note
"Oracle Client / Server Interoperability Support" (ID 207303.1).

You must install libclntsh.so.19.1 to use this package, provided
in the database installation, or in the free Oracle Instant Client
available from Oracle.
...

这在为 PHP 安装 Oracle 扩展中有详细说明


推荐阅读