OCI8 脚本给出空白页
好的,我正在尝试将 OCI8 与 PHP 5.3.x 和 Oracle 10g 以及最新的 Apache 2.2.x 一起使用!我做了用 Oracle & 编写的所有内容。 PHP地下手册来设置它。但是当运行这个脚本时,我得到的只是一个空白页面,没有错误/警告!我已经设置 PHP 来显示错误,但仍然没有运气!我还安装了 10g 的 Oracle 即时客户端!有人可以帮我吗!再次感谢 !
我试图查看连接是否有效的脚本是,
ini_set('error_reporting', E_ALL);
ini_set('display_errors','On');
if ($c = oci_connect("scott", "tiger", "ORCL")) {
echo "Successfully connected to Oracle.";
oci_close($c);
} else {
$err = oci_error();
echo "Oracle Connect Error " . $err['text'];
}
Okay, I am trying to use OCI8 with PHP 5.3.x and Oracle 10g and the latest Apache 2.2.x ! I did everything written in Oracle & PHP underground manual to set it up. But when run this, script, all I get is a blank page with no errors/warnings ! I have setup PHP to show errors but still no luck ! I have also installed Oracle instant Client for 10g ! Can someone please help me ! Thanks again !
The Script which I am trying to see whether the connection works is ,
ini_set('error_reporting', E_ALL);
ini_set('display_errors','On');
if ($c = oci_connect("scott", "tiger", "ORCL")) {
echo "Successfully connected to Oracle.";
oci_close($c);
} else {
$err = oci_error();
echo "Oracle Connect Error " . $err['text'];
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编辑:
我刚刚发现你的错误!
您需要在
$err['message'] string
中引用错误,而不是$err['text']
A
print_r()
数组会给你这样的东西:$err 是数组:数组 ( [code] => 1017 [message] => ORA-01017: 无效的用户名/密码;登录被拒绝 [offset] => 0 [sqltext] => )
或其他类似于您的错误消息的内容。我知道这是一篇旧文章,毫无疑问您现在已经明白了,但希望对将来的参考有用。
原文:
您可以尝试使用:
set_error_handler()
来设置错误异常捕获函数。说实话,我发现你的帖子是因为我也有同样的问题。但是,当我在错误处理函数中捕获错误时,我可以很好地将其回显给浏览器。
但不确定这是否完全满足您的要求。
EDIT:
I just spotted your error!
You need to reference your error in the
$err['message'] string
, not$err['text']
A
print_r()
of the array will give you something like this:$err is array: Array ( [code] => 1017 [message] => ORA-01017: invalid username/password; logon denied [offset] => 0 [sqltext] => )
Or something else resembling your error message. I know this is an old post, and you've no doubt got it by now, but hopefully useful for future reference.
ORIGINAL TEXT:
You could try using:
set_error_handler()
to set an error exception catching function.To be honest, I found your post because I have the same problem. But when I catch the error in an error-handling function, I can echo it back to the browser just fine.
Not sure if this fully answers your requirements though.