php中的Oracle数据库连接问题

时间:2015-04-19 05:06:32

标签: php oracle

我在IP:10.21.30.178上有一个数据库port:1525,其中包含凭据user:FUNREADpass:clock24service name:DRFUNPD1

我正在尝试从我的计算机(10.21.30.220)进行连接,并在下面编写代码进行连接。

<?php

    // Connects to the XE service (i.e. database) on the "localhost" machine
    $conn = oci_connect('FUNREAD', 'clock24', '10.6.8.51:1525/DRFUNPD1');
    if (!$conn) {
        $e = oci_error();
        trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
    }

    $stid = oci_parse($conn, 'SELECT * FROM employees');
    oci_execute($stid);

    echo "<table border='1'>\n";
    while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) {
        echo "<tr>\n";
        foreach ($row as $item) {
            echo "    <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) :    "&nbsp;") . "</td>\n";
        }
        echo "</tr>\n";
    }
    echo "</table>\n";

?>

但是低于错误..

  

致命错误:在第4行的C:\ xampp \ htdocs \ bkash \ pending.php中调用未定义的函数oci_connect()

1 个答案:

答案 0 :(得分:0)

根据fatail错误消息,您没有安装OCI8扩展程序:

http://php.net/manual/en/oci8.installation.php