我尝试建立与 oracle 数据库的连接,但我仍然无法建立模块。我有 rhel 7.2 服务器,我按照整个教程设置 oracle instantclient 并用 php 配置它。我完全不明白的一件事是 oci8 模块在 php -i
执行后显示:
oci8
OCI8 Support => enabled
OCI8 DTrace Support => disabled
OCI8 Version => 2.1.3
Revision => $Id: 59f993160cf983dd24bb391b68a65a17303d2dba $
Oracle Run-time Client Library Version => 12.1.0.2.0
Oracle Compile-time Instant Client Version => 12.1
Directive => Local Value => Master Value
oci8.connection_class => no value => no value
oci8.default_prefetch => 100 => 100
oci8.events => Off => Off
oci8.max_persistent => -1 => -1
oci8.old_oci_close_semantics => Off => Off
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
但是脚本里面的phpinfo()中没有这个模块。如何解决?
PHP 版本 7.0.13 服务器 Apache (httpd)
[![在此处输入图片描述][2]][2]
最佳答案
常见的问题是没有为 Apache 设置 LD_LIBRARY_PATH。
尝试将其添加到 /etc/sysconfig/httpd
中,例如:
LD_LIBRARY_PATH=/full/path/to/oracle-client
如果我的版本正确,此版本的 Apache (i) 不喜欢用于设置变量的 export
关键字 (ii) 需要完整路径,因为它不会扩展环境变量。如果我错了,请尝试其中一个或两个。
免费Underground Oracle & PHP Manual里面有很多关于环境设置的资料,请参阅第 108 页的“为 Apache 设置 Oracle 环境变量”
您说您遵循了“整个教程”。有很多教程。我推荐 Oracle's installation instructions .
关于php - phpinfo() 中没有 oci8 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41043724/