在Windows XP 3 32位上使用XAMPP 1.7.4中的PHP 5.3.5连接Oracle 11g

时间:2015-03-31 13:10:13

标签: php oracle11g xampp database-connection environment-variables

我正在尝试使用来自我的32位Windows操作系统上的XAMPP的PHP在Windows 2003上连接我的远程Oracle 11g数据库。我经历了很多教程,博客和视频。我尝试了https://www.youtube.com/watch?v=hMhkD43yUzI by 1niko2niko

我做了什么,

C:\ xampp

上安装了XAMPP 1.7.4 32位
;extension=php_oci8.dll => extension=php_oci8.dll 
位于 C:\ xampp \ php

内的

(删除分号)前面的php.ini

http://www.oracle.com/technetwork/topics/winsoft-085727.html下载了Oracle Instant Client 11.2.0.4.0并解压缩到 C:\ instantclient_11_2

我的电脑=>右键单击=>属性=>高级=>环境变量=> System Vairables =>编辑=>路径=> C:\ instantclient_11_2 \ =>好的> OK =>确定

我在互联网上找到的PHP连接字符串:

<?php
$conn = oci_connect('user','pass','111.111.111.111/sid');
// Prepare the statement
$stid = oci_parse($conn, 'SELECT * FROM  names');
if (!$stid) {
$e = oci_error($conn);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Perform the logic of the query
$r = oci_execute($stid);
if (!$r) {
$e = oci_error($stid);
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
// Fetch the results of the query
print "<table border='1'>\n";
while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
print "<tr>\n";
foreach ($row as $item) {
    print "    <td>" . ($item !== null ? htmlentities($item,ENT_QUOTES)    : "&nbsp;") . "</td>\n";
}
print "</tr>\n";
}
print "</table>\n";
?>

我在Win XP,Win 7下使用虚拟框尝试了这个过程。

重新启动计算机并显示以下结果

Warning: oci_connect() [function.oci-connect]: OCIEnvNlsCreate() failed. There is something wrong with your system - please check that PATH includes the directory with Oracle Instant Client libraries in C:\xampp\htdocs\oracle\index.php on line 3

Warning: oci_parse() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\oracle\index.php on line 6

Warning: oci_error() expects parameter 1 to be resource, boolean given in C:\xampp\htdocs\oracle\index.php on line 8

Fatal error: in C:\xampp\htdocs\oracle\index.php on line 9

0 个答案:

没有答案