oracle PHP 中的 oci_connect 空白页

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2389569/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-18 20:08:47  来源:igfitidea点击:

oci_connect Blank Page in PHP

phporaclepecloci8

提问by Bryan

UPDATE (5/21/2010) SUCCESS!

更新 (5/21/2010) 成功!

So after MUCH $head->desk()'ing, I've solved it.

所以经过多次 $head->desk()'ing 之后,我解决了它。

Remember kids, be wary of the instant client version you use, dependent on the virtualization settings!

记住孩子,要警惕您使用的即时客户端版本,这取决于虚拟化设置!

I had been installing the generic Instant Client (not aware our ESX servers sit on AMD processors, not Intel) and that worked fine internally (the CentOS install was 32-bit since our internal ESXi servers aren't 64-bit). Well lo-and-behold, even if you have a 32-bit install running on a virtualized server which is sitting on an AMD64, it still matters what instant client you install.

我一直在安装通用的 Instant Client(不知道我们的 ESX 服务器安装在 AMD 处理器上,而不是 Intel)并且在内部运行良好(CentOS 安装是 32 位,因为我们的内部 ESXi 服务器不是 64 位)。瞧,即使您在 AMD64 上的虚拟化服务器上​​运行 32 位安装,安装什么即时客户端仍然很重要。

It was the last thing I thought to check but as it appears, everything is running fine now.

这是我想检查的最后一件事,但看起来,现在一切都运行良好。

I would like to thank everyone who helped me run through every possible test to figure this out but in the end, it was my fault for not realizing the differences in the virtualizations.

我要感谢所有帮助我通过所有可能的测试来解决这个问题的人,但最终,我没有意识到虚拟化的差异是我的错。



UPDATE (5/21/2010)I thought this bug had escaped me when I installed it on a new VM internally but I have now found a narrowing link.

更新(2010 年 5 月 21 日)当我在内部将它安装到新的 VM 上时,我认为这个错误已经逃脱了我,但我现在找到了一个缩小的链接。

I was trying to install this on our production server when I posted this. After a week of no progress and in need to get back to development, I outfitted a VM on our internal server with a brand new install of Crap... CentOS, and fresh installs of instant client and oci8.

当我发布这个时,我试图在我们的生产服务器上安装它。在一周没有进展并且需要重新开始开发之后,我在我们的内部服务器上为虚拟机配备了全新安装的 Crap ... CentOS,以及即时客户端和 oci8 的全新安装。

Worked perfectly.

完美地工作。

However we just uploaded an exact copy of the VM to our production servers and it magically no longer works. Tried reinstalling everything, no avail.

然而,我们刚刚将 VM 的精确副本上传到我们的生产服务器,它神奇地不再起作用。尝试重新安装所有内容,无济于事。

So the only things I could narrow it down to is a firewall issue (although I get the same issue when trying 127.0.0.1) or possibly an ESX (our production servers) server issue, internal servers are running ESXi.

所以我唯一可以缩小范围的是防火墙问题(尽管我在尝试 127.0.0.1 时遇到了同样的问题)或者可能是 ESX(我们的生产服务器)服务器问题,内部服务器正在运行 ESXi。

Any thoughts?

有什么想法吗?

UPDATE (3/8/2010)I installed Xdebug and have it tracing my code. This is the output I am getting:

更新 (3/8/2010)我安装了 Xdebug 并让它跟踪我的代码。这是我得到的输出:

TRACE START [2010-03-08 17:53:05]
    0.2090     327864   -> {main}() /data/aims3/http/octest.php:0
    0.2091     327988     -> ini_set(string(14), string(1)) /data/aims3/http/octest.php:3
    0.2093     327920     -> error_reporting(long) /data/aims3/http/octest.php:4
    0.2094     328048     -> oci_connect(string(8), string(8), string(25)) /data/aims3/http/octest.php:6

The trace halts at that point.

跟踪在该点停止。

I have installed everything the same way on a local server and it works fine. To say I am at a complete loss would be putting it lightly.

我已经在本地服务器上以相同的方式安装了所有东西,并且运行良好。说我完全不知所措是轻描淡写。



*NOTE: I ran make test and it returned FAIL on every test. I never ran this on my working machine to see if it reports the same errors. Any idea why make test would report FAIL but make doesn't report any error?

*注意:我运行了 make test 并且每次测试都返回 FAIL。我从来没有在我的工作机器上运行过它,看看它是否报告了相同的错误。知道为什么 make test 会报告 FAIL 但 make 不报告任何错误吗?

I've installed the Oracle Instantclient with no reported errors along with the OCI8 PECL package and at a loss. Whenever I try to open a connection with oci_connect, it halts my entire PHP script.

我已经安装了 Oracle Instantclient 并且没有报告错误以及 OCI8 PECL 包并且不知所措。每当我尝试打开与 oci_connect 的连接时,它都会停止我的整个 PHP 脚本。

EXAMPLE:

例子:

<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
echo "before";
$conn = oci_connect("username", "password", "host");
echo "after";
?>

Returns a complete blank page. The module is loaded (seen in phpinfo) and everything installed with no errors.

返回一个完整的空白页。该模块已加载(在 phpinfo 中可见)并且所有内容均已安装且没有错误。

I am at a complete loss.

我完全不知所措。

CentOS: 5.4

CentOS:5.4

Apache: 2.2.3

阿帕奇:2.2.3

PHP: 5.3.1

PHP:5.3.1

InstantClient: 11.2

即时客户端:11.2

oci8: 1.4.1

oci8: 1.4.1

Any thoughts?

有什么想法吗?

NOTES

笔记

Apache Error Log reports nothing

Apache 错误日志不报告任何内容

Attempted Debugging:

尝试调试:

1:

1:

<?php
ini_set ("display_errors", "1");
error_reporting(E_ALL);
echo "before";
if(!function_exists('oci_connect')) die('Oracle Not Installed');
echo "after";
?>

Returns:

返回:

beforeafter

2:

2:

Changing host to //host

将主机更改为 //host

Returns:

返回:

Same error

同样的错误

采纳答案by Bryan

It has been fixed. See the top for details but here is the cliff notes: virtualiztion environments matter.

它已被修复。有关详细信息,请参阅顶部,但这里是悬崖注释:虚拟化环境很重要。

回答by Josh

Is there anything in Apache's error_log? Is this mod_php or FastCGI or normal CGI PHP? What happens if you run the script via the command line?

Apache 的 error_log 中是否有任何内容?这是 mod_php 或 FastCGI 还是普通的 CGI PHP?如果通过命令行运行脚本会发生什么?

You could also try setting PHP's error logand looking in there.

您也可以尝试设置PHP 的错误日志并查看那里。



EDIT1: Try:

EDIT1:尝试:

echo "before";
if(!function_exists('oci_connect')) die('Oracle Not Installed');

And post the results...

并公布结果...



EDIT2: I'm really not sure. My best bet is this info from the PHP manual:

EDIT2:我真的不确定。我最好的选择是PHP 手册中的以下信息:

The most common problem with installing OCI8 is not having the Oracle environment correctly set. This typically appears as a problem using oci_connect() or oci_pconnect(). The error may be a PHP error such as Call to undefined function oci_connect(), an Oracle error such as ORA-12705, or even an Apache crash. Check the Apache log files for startup errors and see the sections above to resolve this problem.

安装 OCI8 最常见的问题是没有正确设置 Oracle 环境。这通常表现为使用 oci_connect() 或 oci_pconnect() 的问题。该错误可能是 PHP 错误(例如 Call to undefined function oci_connect())、Oracle 错误(例如 ORA-12705),甚至是 Apache 崩溃。检查 Apache 日志文件是否有启动错误,并查看上述部分以解决此问题。

Anyone else have any ideas to help out Bryan?

还有其他人有任何想法可以帮助布莱恩吗?

回答by TomWilsonFL

Bryan,

布莱恩,

I am going to be honest: I tried this two years ago and failed miserably. :) I could not get the OCI functions to work for anything by compiling myself.

老实说:我两年前尝试过,但失败了。:) 我无法通过自己编译使 OCI 函数为任何事情工作。

But in the interest of getting it done I looked for an alternate solution and found it in Zend Core for Oracle. All I did was download, run the installer, and it was done. It installs Apache/PHP, MySQL (optional), and the InstantClient for you.

但是为了完成它,我寻找了一个替代解决方案,并在 Zend Core for Oracle 中找到了它。我所做的就是下载,运行安装程序,然后就完成了。它会为您安装 Apache/PHP、MySQL(可选)和 InstantClient。

Now as Zend Server, it is basically the same product. I realize that this may not be the solution you hoped for, but if it works...

现在作为 Zend Server,基本上是同一个产品。我意识到这可能不是您希望的解决方案,但如果它有效......

Zend Server

Zend 服务器

回答by cupakob

are you connecting to remote or to local db? i think, for localhost you must replace "host" with "false". I hope, this will help you...

您是连接到远程数据库还是本地数据库?我认为,对于本地主机,您必须将“主机”替换为“假”。我希望这能帮到您...

edit: i think, you are missing a parameter...my last suggestions are: 1. you must set the port (default 1521) AND/OR 2. You must enter db name AND/OR you must set the instance name (the ORACLE_SID parameter)

编辑:我认为,您缺少一个参数...我最后的建议是:1.您必须设置端口(默认为 1521)和/或 2.您必须输​​入数据库名称和/或您必须设置实例名称( ORACLE_SID 参数)

回答by álvaro González

You never check the return value of oci_connect() or call oci_error() but it doesn't look relevant to your problem since you seem to be suffering from a PHP crash. There's an open bug for RHEL that may affect you too:

您从不检查 oci_connect() 的返回值或调用 oci_error() 但它看起来与您的问题无关,因为您似乎遇到了 PHP 崩溃。RHEL 有一个未解决的错误,可能也会影响您:

http://pecl.php.net/bugs/bug.php?id=16626

http://pecl.php.net/bugs/bug.php?id=16626

Did you build the oci8 package yourself? Are you using a third-party binary?

你自己构建了oci8包吗?您使用的是第三方二进制文件吗?