我正在开发一个连接到Oracle数据库的PHP API,但不幸的是连接不起作用。首先,我想实现了开发环境(oracle数据库服务器+ apache服务器),所有配置都很好。问题是我写的代码没有得到任何回复,即使我输入的数据不正确。
PHP Info oci8:
[rvieira@localhost ~]$ php --ri oci8
oci8
OCI8 Support => enabled
Version => 1.4.10
Revision => $Id: 44bfa713983a99b3e59477f6532e5fb51b6dee94 $
Active Persistent Connections => 0
Active Connections => 0
Oracle Run-time Client Library Version => 11.2.0.2.0
Oracle Instant Client Version => 11.2
Temporary Lob support => enabled
Collections support => enabled
Directive => Local Value => Master Value
oci8.max_persistent => -1 => -1
oci8.persistent_timeout => -1 => -1
oci8.ping_interval => 60 => 60
oci8.privileged_connect => Off => Off
oci8.statement_cache_size => 20 => 20
oci8.default_prefetch => 100 => 100
oci8.old_oci_close_semantics => Off => Off
oci8.connection_class => no value => no value
oci8.events => Off => Off
PHP代码:
<?php
$connection = oci_connect('sys', 'rvieira', 'localhost/xe');
if (!$connection) {
$m = oci_error();
echo $m['message'], "\n";
exit;
}
else {
print "Connected to Oracle!";
}
?>
我还留下了我配置开发环境所遵循的教程:
答案 0 :(得分:1)
您的错误消息表明环境变量LD_LIBRARY_PATH
存在问题,但未详细说明具体内容。设置此项将在“在Linux上启用PHP OCI8扩展”的步骤6中介绍,您可以在first link找到该文件。
仔细检查你的安装 - 你可能错过了什么。