我正在开发一个连接到 Oracle 数据库的 PHP API,但不幸的是连接不起作用。首先,我实现了开发环境(oracle数据库服务器+apache服务器),一切都配置好了,我猜。问题是我没有从我写的代码中得到任何响应,即使我输入了不正确的数据。
PHP信息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!";
}
?>
我还将在此处留下配置开发环境所遵循的教程: