简体   繁体   English

PHP Oracle:oci_connect不显示错误

[英]PHP Oracle: oci_connect doesn't show error

There is an error in the oci_connect line. oci_connect行中有错误。 But my problem is that the error doesn't show in the page. 但是我的问题是该错误没有显示在页面中。 Even if I put $e = oci_error(); 即使我把$e = oci_error(); it will not be executed anymore to show the error. 它不会再执行以显示错误。 I tried try/catch but it didn't work either. 我尝试了try / catch,但是也没有用。

When I change the connection details to connect to another database it works. 当我更改连接详细信息以连接到另一个数据库时,它将起作用。 The connection details I use do work in SQL Developer. 我使用的连接详细信息可以在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;

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. 尝试更改PHP.ini文件设置以显示所有错误后,实际上没有显示任何错误,然后我更新了Oracle Instant Client版本。

First I check what Oracle version I'm using: 首先,我检查使用的Oracle版本:

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. 之后,我下载了新的Oracle Instant Client版本11.2.0.3.0,并将其设置为PATH并重新启动了服务器。 Then it worked! 然后成功了!

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

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