简体   繁体   English

在Windows x64中从PHP连接到Oracle数据库

[英]Connect from php to oracle database in windows x64

I am trying to connect from php to oracle database in windows x64 我正在尝试从php连接到Windows x64中的oracle数据库

I use: php5, apache2, oraclexe 10.2 我使用:php5,apache2,oraclexe 10.2

My file "test.php" is the following: 我的文件“ test.php”如下:

 <?php
  if ($c = oci_connect("SYSTEM", "root", "//localhost:1521/XE")) {
   echo "Successfully connected to Oracle.";
   oci_close($c);
  } else {
   $err = oci_error();
   echo "Oracle Connect Error " . $err['text'];
  }
 ?>

When I open localhost/test.php, getting a following error: 当我打开localhost / test.php时,出现以下错误:

Warning: oci_connect() [function.oci-connect]: ORA-06413: Connection not open

I can not understand the cause of this error, because I have already connected to the same database from Java, and I think the php.ini file is well configured, because I managed to connect from php to MySQL database. 我无法理解此错误的原因,因为我已经从Java连接到同一数据库,并且我认为php.ini文件配置正确,因为我设法从php连接到MySQL数据库。 Also followed this tutorial: http://www.orafaq.com/wiki/PHP_FAQ 还遵循了本教程: http : //www.orafaq.com/wiki/PHP_FAQ

So if someone have a solutions and comments post it please 因此,如果有人有解决方案并发表评论,请

Is XE the service name of your database? XE是数据库的服务名称吗? That's the name used in the example code that you have to change. 那就是您必须更改的示例代码中使用的名称。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM