当前位置: 首页 > 知识库问答 >
问题:

尝试安装Loganalyzer 4.1.5时出现PHP错误

江阳冰
2023-03-14

我成功地测试了向它发送syslog消息,并且可以看到数据库到目前为止正在收集这些消息。我还成功地测试了php可以连接到我为rsyslog设置的数据库

    <?php
    $link = mysqli_connect("{host}", "{user}", "{password}", "{database}");

    if (!$link) {
        echo "Error: Unable to connect to MySQL." . PHP_EOL;
        echo "Debugging errno: " . mysqli_connect_errno() . PHP_EOL;
        echo "Debugging error: " . mysqli_connect_error() . PHP_EOL;
        exit;
    }

    echo "Success: A proper connection to MySQL was made!." . PHP_EOL;
    echo "Host information: " . mysqli_get_host_info($link) . PHP_EOL;

    mysqli_close($link);
    ?>

然后,我从命令行php-fdb-test.php运行这个命令,它似乎起作用了。

我的问题似乎是在运行Loganalyzer install.php文件时出现的。

[Mon Dec 12 15:23:21.563908 2016] [:error] [pid 1400] [client {ip}:50958] PHP Warning:  mysqli_select_db() expects parameter 1 to be mysqli, string given in /var/www/html/loganalyzer/install.php on line 382, referer: http://{ip}/loganalyzer/install.php?step=3

    >>> this is the line from install.php
        // Try to select the DB!
                                $db_selected = mysqli_select_db($_SESSION['UserDBName'], $link_id);
                                if(!$db_selected)
                                        RevertOneStep( $content['INSTALL_STEP']-1, GetAndReplaceLangStr( $content['LN_INSTALL_ERRORACCESSDENIED'], $_SESSION['UserDBName']) . "<br>" . DB_ReturnSimpleErrorMsg());


[Mon Dec 12 15:23:21.563997 2016] [:error] [pid 1400] [client {IP}:50958] PHP Warning:  mysqli_errno() expects parameter 1 to be mysqli, integer given in /var/www/html/loganalyzer/include/functions_db.php on line 215, referer: http://{ip}/loganalyzer/install.php?step=3
[Mon Dec 12 15:23:21.564013 2016] [:error] [pid 1400] [client {IP}:50958] PHP Warning:  mysqli_error() expects parameter 1 to be mysqli, integer given in /var/www/html/loganalyzer/include/functions_db.php on line 215, referer: http://{ip}/loganalyzer/install.php?step=3

    >>>> this is the line from functions_db.php
        // Return Mysql Error
                return "Mysql Error " . mysqli_errno($userdbconn) . " - Description: " . mysqli_error($userdbconn);
}

我已经把头撞到墙上有一阵子了。谁能给我指个正确的方向吗?

共有1个答案

岳浩穰
2023-03-14

mysql_select_db的参数似乎错误,应该是mysqli_select_db(mysqli$link,string$dbname)

因此,将该行更改为$db_selected=mysqli_select_db($link_id,$_session['userdbname']);应该可以纠正该错误。

我还将检查$userdbconn$link_id的设置位置。mysqli_errno()当前传递的连接无效。

 类似资料:
  • 以下是从终端返回的确切消息: 错误:安装sass时出错:错误无法生成gem本机扩展。当前目录:/Library/Ruby/Gems/2.0。0/gems/ffi-1.9。18/ext/ffi_c/System/Library/Frameworks/Ruby。framework/Versions/2.0/usr/bin/ruby-r/siteconf20170721-3751-3vsh43。rb e

  • Boilerpipe是一个很好的Java程序,用于清理网页,我以前也使用过它。今天我注意到,许多用户无法安装Python包装器版本,并出现404和其他错误。这是我从康达那里复制的一个尝试。 /用户/邓肯 命令"pythonsetup.pyegg_info"失败,错误代码1在 /tmp/pip-r6swd0hy-build/ 我见过一些对我不起作用的解决方案(例如:谷歌改变了其模块的URL),如果有

  • 问题内容: 我已经安装了Microsoft Visual Studio 2008。我下载了适用于Windows扩展的zip文件Python并将其内容提取到我的Python27文件夹中。现在有一个名为pywin32-214的子文件夹。(这是32部分的问题吗?我使用的是64位系统。)以下是命令行的文字记录: 我不知道该怎么做。救命? 问题答案: 如果您安装的是64位Python: 在启用“ X64编译

  • 问题内容: 我用–no-site-packages选项创建了一个virtualenv。尝试安装PIL时出现错误: http://pastebin.com/SVqxs1sC 有人可以帮我弄这个吗? 我正在运行Ubuntu 10.04(64位) 问题答案: 您需要安装python-dev软件包。

  • 我试图在命令shell上使用安装,但出现以下错误: 使用缓存收集rpy2https://files.pythonhosted.org/packages/c7/43/401afad8556bf92b08bd7d422cacac614b0e8dd2bce31848318bbcb18f48/rpy2-3.0.5.tar.gz错误:从命令python安装程序完成输出。py egg_info:ERROR:T

  • 当使用设置时,如何解决这个问题?我尝试设置,但当我完成所有操作并使用时,什么也没有出现? npm http GET https://registry.npmjs.org/Cordova npm错误!fstream_class:'dirwriter', npm错误!fstream_stack: npm错误!['/usr/lib/nodejs/fstream/lib/writer.js:171:23'