Menu

PHP Warning: mysqli_close() expects parameter 1 to be mysqli, null given

Patrick
2019-01-08
2019-01-10
  • Patrick

    Patrick - 2019-01-08

    Hello,

    I have a vanilla install of the latest NagiosQL version, 3.40, on my Centos 7.5 server with PHP 7.2 (remi) and MariaDB 5.5 installed. Nagios is installed alongside and working normally, the MariaDB is functioning properly

    I can complete the NagiosQL installation with all green ticks, however clicking the login button on the login page does nothing. I have checked and am using the correct credentials. Each click generates the following error message in the apache logs:

    PHP Warning: mysqli_close() expects parameter 1 to be mysqli, null given in /usr/local/nagios/share/webadmin/functions/MysqliDbClass.php on line 409, referer: https://nagios/nagios/webadmin/index.php

    Do you have an guidance on how best to troubleshoot this?

    Happy to provide any additional details as required, the following PHP packages are installed

    php72-runtime-1.0-1.el7.remi.x8664
    php72-php-pdo-7.2.13-2.el7.remi.x8664
    php72-php-pear-1.10.7-4.el7.remi.noarch
    php72-php-gd-7.2.13-2.el7.remi.x8664
    php72-php-mbstring-7.2.13-2.el7.remi.x8664
    php-cli-7.2.13-2.el7.remi.x8664
    php-process-7.2.13-2.el7.remi.x8664
    php-mysqlnd-7.2.13-2.el7.remi.x8664
    php72-php-json-7.2.13-2.el7.remi.x8664
    php72-php-cli-7.2.13-2.el7.remi.x8664
    php72-php-mysqlnd-7.2.13-2.el7.remi.x8664
    php72-php-process-7.2.13-2.el7.remi.x8664
    php72-php-pecl-mysql-1.0.0-0.17.20160812git230a828.el7.remi.x8664
    php72-php-pecl-mcrypt-1.0.1-4.el7.remi.x8664
    php72-php-fpm-7.2.13-2.el7.remi.x8664
    php72-php-opcache-7.2.13-2.el7.remi.x8664
    php-json-7.2.13-2.el7.remi.x8664
    php-fpm-7.2.13-2.el7.remi.x8664
    php-fedora-autoloader-1.0.0-1.el7.noarch
    php-xml-7.2.13-2.el7.remi.x8664
    php-pdo-7.2.13-2.el7.remi.x8664
    php72-php-common-7.2.13-2.el7.remi.x8664
    php72-php-xml-7.2.13-2.el7.remi.x8664
    php72-1.0-1.el7.remi.x8664
    php72-php-xmlrpc-7.2.13-2.el7.remi.x8664
    php-common-7.2.13-2.el7.remi.x8664
    php-7.2.13-2.el7.remi.x8664
    php-pear-1.10.7-4.el7.remi.noarch

     
  • Martin

    Martin - 2019-01-08

    Can you check if mysqli is avalable:

    php -m | grep mysqli

    I'don't see it in your module list.

     
  • Patrick

    Patrick - 2019-01-08

    Hi Martin,

    I belieive mysqli functionality is enabled by the php72-php-mysqlnd-7.2.13-2.el7.remi.x86_64 package. The installation completed successfully I assume using mysqli to connect?

    Output of the command below

    [root@nagios etc]# php -m | grep mysqli
    mysqli

     
  • Martin

    Martin - 2019-01-09

    I can't imagine a logical reason for this mistake right now. It is also the first time an error of this kind has occurred.

    Normally the ID is created during the initial DB connection, even before the username or password is submitted. If this connection fails, the DB server might not be available or not respond at all. However, in this case the installation should have failed also.

    CentOS uses application security (SELinux) - this has caused strange and difficult to explain side effects in the past. Does any log file output anything more (Apache Log, Auditd Log etc.)?

     
  • Patrick

    Patrick - 2019-01-10

    Hi Martin,

    I tracked the problem down - the mysql password I had specified had special characters in it. Encompassing the password in ' ' in the /opt/nagiosql/config/settings.php has resolved the problem

    Thanks for looking into this

     

Log in to post a comment.