duannian4784 2015-01-27 08:44
浏览 115

PHP Oracle:oci_connect不显示错误

There is an error in the oci_connect line. But my problem is that the error doesn't show in the page. Even if I put $e = oci_error(); it will not be executed anymore to show the error. I tried try/catch but it didn't work either.

When I change the connection details to connect to another database it works. The connection details I use do work in SQL Developer.

$db='(DESCRIPTION =
(ADDRESS_LIST =
  (ADDRESS = (PROTOCOL = TCP)(HOST = '. $GLOBALS['HOST']. ')(PORT = '. $GLOBALS['PORT'] .'))
)
(CONNECT_DATA =
  (SID = '. $GLOBALS['SID'] . ')
)
)';
echo '<br>USERNAME: *'. $GLOBALS['USERNAME'] .'*';
echo '<br>PASSWORD: *'. $GLOBALS['PASSWORD'] .'*';
echo '<br>2 db: *'. $db .'*';
$conn = oci_connect($GLOBALS['USERNAME'], $GLOBALS['PASSWORD'], "$db");
echo 'success';
die;
  • 写回答

1条回答 默认 最新

  • doudong1117 2015-01-27 09:52
    关注

    There are really no errors being shown after trying changing the PHP.ini file setting to show all errors, then I have updated the Oracle Instant Client version.

    First I check what Oracle version I'm using:

    select * from v$version
    where banner like 'Oracle%';
    

    Output:

    Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
    

    After this I downloaded new Oracle Instant Client version Version 11.2.0.3.0 and set it to PATH and restarted server. Then it worked!

    评论

报告相同问题?