Javascript &引用;CLI已停止工作“;当尝试使用JQuery从Oracle数据库中选择all时?

Javascript &引用;CLI已停止工作“;当尝试使用JQuery从Oracle数据库中选择all时?,javascript,php,jquery,oracle,Javascript,Php,Jquery,Oracle,我正在尝试使用JavaScript和Jquery搜索数据库。我已经设置了一个generic query.php文件,以便传入数据库和查询,并让它返回一个数组。出于某种原因,当我尝试使用*选择all时,我的PHP服务器崩溃,原因如下: 我使用PHP7.0.2的内置服务器。我正在尝试从Oracle数据库检索信息 以下是邮政声明: $.post(DB1.filename, {sid: DB1.sid, username: DB1.username,

我正在尝试使用JavaScript和Jquery搜索数据库。我已经设置了一个generic query.php文件,以便传入数据库和查询,并让它返回一个数组。出于某种原因,当我尝试使用*选择all时,我的PHP服务器崩溃,原因如下:

我使用PHP7.0.2的内置服务器。我正在尝试从Oracle数据库检索信息

以下是邮政声明:

$.post(DB1.filename, 
        {sid: DB1.sid, 
        username: DB1.username, 
        password: DB1.password,
        host: DB1.host,
        port: DB1.port,
        sql: query}, 

        function(res){
            if(res == -1){
                res = errorCode(DATABASE_CONNECTION_ERROR);
            } else {
                var a = parseObject(res);
                var t = parseTable(a);
                elements[TABLE].element.innerHTML = t;
            }
            log(FILE_NAME, "RETRIEVED query ");
        }
    );
下面是query.php:

<?php   
    /* This script will connect to a database and search the given SQL string.
        If the connection cannot be established, it will return -1. Otherwise, it will return a JSON array.
    */

    //Parameters
    $sql = $_POST["sql"];

    //Database Information
    $user = $_POST["username"];
    $pass = $_POST["password"];
    $host = $_POST["host"];
    $port = $_POST["port"];
    $sid = $_POST["sid"];

    $connection = "(DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = " . $host .")(PORT = " . $port . ")) (CONNECT_DATA = (SID = " . $sid . ")))";

    //Establish connection
    $conn = oci_connect($user, $pass, $connection);

    //Check connection
    if(!$conn){
        echo -1;
    } else {        
        //Query for the given SQL statement
        $stRows = oci_parse($conn, $sql);
        oci_execute($stRows);

        oci_fetch_all($stRows, $res); //This is where the everything actually crashes
        echo json_encode($res);

        //Close the connection
        oci_close($conn);
    } 
?>
一切正常。带有单列的表格将打印到屏幕上

但是,如果我运行:

query = "select * from ALL_TABLES";
我得到上面的错误

无论我尝试连接到哪个表,都会发生这种情况。我的凭据是正确的,我也尝试了不同的凭据。知道为什么会这样吗

--更新--


我努力给列名编码。在崩溃之前,我最多可以选择8列。共有152行。

我通过将oci_fetch_all替换为oci_fetch_数组来避免此错误,如下所示:

    <?php   

    ...

    } else {        
        //Query for the given SQL statement
        $stRows = oci_parse($conn, $sql);
        oci_execute($stRows);

        $res = array();
        while($row = oci_fetch_array($stRows, OCI_NUM)){
            $res[] = $row;
        }
        echo json_encode($res);

        //Close the connection
        oci_close($conn);
    } 
?>


这意味着对用于解码JSON对象数组的函数进行了重大更改,但它确实可以工作。不过,我不会将此答案标记为正确答案,因为我非常想知道我的原始代码为什么不起作用…

我通过将oci_fetch_all替换为oci_fetch_数组来规避此错误,如下所示:

    <?php   

    ...

    } else {        
        //Query for the given SQL statement
        $stRows = oci_parse($conn, $sql);
        oci_execute($stRows);

        $res = array();
        while($row = oci_fetch_array($stRows, OCI_NUM)){
            $res[] = $row;
        }
        echo json_encode($res);

        //Close the connection
        oci_close($conn);
    } 
?>


这意味着对用于解码JSON对象数组的函数进行了重大更改,但它确实可以工作。我不会将这个答案标记为正确,因为我非常想知道为什么我的原始代码不能工作…

php错误日志显示了什么?可能是内存限制问题。尝试在php中将内存限制设置为0。@steven-我试过了。它没有解决问题…@codeHeart-据我所知,内置PHP服务器默认没有错误日志。我在php.ini文件中添加了log_errors=On和error_log=/tmp/php_error.log,但没有在崩溃时创建日志。php错误日志显示了什么?可能是内存限制问题。尝试在php中将内存限制设置为0。@steven-我试过了。它没有解决问题…@codeHeart-据我所知,内置PHP服务器默认没有错误日志。我在php.ini文件中添加了log_errors=On和error_log=/tmp/php_error.log,但没有在崩溃时创建日志。