开发者

OCI8 script giving a blank page

开发者 https://www.devze.com 2023-03-17 00:39 出处:网络
Okay, I am trying to use OCI8 with PHP 5.3.x and Or开发者_开发问答acle 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

Okay, I am trying to use OCI8 with PHP 5.3.x and Or开发者_开发问答acle 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'];
 }


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号