[英]Oracle Connection Error in PHP. Fatal error: Call to undefined function oci_connect()
I am working on this project where i need to connect to the Oracle database. 我正在该项目中工作,需要连接到Oracle数据库。 I am using the latest version of WAMP 2.2 and also activated all the extensions related the Oracle in PHP extensions. 我正在使用最新版本的WAMP 2.2,并且还激活了与PHP扩展中的Oracle相关的所有扩展。 I have used following code for the connection to Oracle Database. 我已使用以下代码连接到Oracle数据库。
<?php
$dbHost = "192.168.0.205";
$dbHostPort="1523";
$dbServiceName = "orcl";
$usr = "system";
$pswd = "admin";
$dbConnStr = "(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)
(HOST=".$dbHost.")(PORT=".$dbHostPort."))
(CONNECT_DATA=(SERVICE_NAME=".$dbServiceName.")))";
if(!$dbConn = oci_connect($usr,$pswd,'192.168.0.205:1158/em')){
$err = oci_error();
trigger_error('Could not establish a connection: ' . $err['message'], E_USER_ERROR);
}
else
{
echo "COnnected";
}
$strSQL = "SELECT SYSDATE FROM DUAL";
$stmt = oci_parse($dbConn,$strSQL);
if ( ! oci_execute($stmt) ){
$err = oci_error($stmt);
trigger_error('Query failed: ' . $err['message'], E_USER_ERROR);
};
while(oci_fetch($stmt)){
$rslt = oci_result($stmt, 1); print "<h3>query returned: ".$rslt."</h3>";
}
?>
Kindly suggest the error. 请提示错误。 Thanks in advance. 提前致谢。
The OCI8 PHP extension is not available in your PHP installation. OCI8 PHP扩展在您的PHP安装中不可用。 See the manual of the OCI8 PHP extension for installtion instructions. 有关安装说明,请参见OCI8 PHP扩展手册 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.