Ad Widget

Collapse

Database error after updating to PHP 7.3 packages on RHEL7

Collapse
This topic has been answered.
X
X
 
  • Time
  • Show
Clear All
new posts
  • martynasj
    Junior Member
    • May 2022
    • 6

    #1

    Database error after updating to PHP 7.3 packages on RHEL7

    Hello, I have following setup:
    RHEL 7.9
    zabbix-server 5.0.7
    rh-php72

    I followed these steps to upgrade php to rh-php73.
    After this when I go to zabbix web page I get error page:
    Error: zabbix database error no such file or directory

    /info.php shows that all is ok. I don't see any errors in zabbix-server.log. When I enable debug I can see communication with agents, but no relevant errors about DB. When I backtrack upgrade steps and switch back to rh-php72, zabbix works fine.
    I tried zabbix versions 5.0.8 and 5.0.23 with same result. Also made fresh install on test server and tried same update steps with no issues.

    Only thing is strange is that after upgrade zabbix services doesn't show as started, but I see processes running with ps.

    Maybe someone had something similar and can advice?
  • Answer selected by martynasj at 15-05-2022, 22:44.
    martynasj
    Junior Member
    • May 2022
    • 6

    Comparing the settings in the pool or php.ini/php.d/whatever.ini will probably take some manual inspection.
    This was the issue. After manual inspection trough rh-php files I found that old rh-php72 installation had this parameters set on /etc/opt/rh/rh-php72/php.ini
    Code:
    [MySQLi]
    mysqli.default_socket = /opt/app/mysql/mysql.sock
    mysqli.default_host = localhost
    mysqli.default_user = zabbix
    mysqli.default_pw = ********
    Adding same for rh-php73 fixed the issue.

    Comment

    • tim.mooney
      Senior Member
      • Dec 2012
      • 1427

      #2
      Originally posted by martynasj
      Hello, I have following setup:
      RHEL 7.9
      zabbix-server 5.0.7
      rh-php72

      I followed these steps to upgrade php to rh-php73.
      After this when I go to zabbix web page I get error page:
      Error: zabbix database error no such file or directory

      /info.php shows that all is ok. I don't see any errors in zabbix-server.log. When I enable debug I can see communication with agents, but no relevant errors about DB. When I backtrack upgrade steps and switch back to rh-php72, zabbix works fine.
      I tried zabbix versions 5.0.8 and 5.0.23 with same result. Also made fresh install on test server and tried same update steps with no issues.
      You don't say which web server you're using, but for RHEL I would assume Apache httpd. It appears there's an error in their documentation for the SetHandler statement (the PHP 7.3 example is missing a "-" in the php-fpm directory part of the path), but if /info.php says everything is OK, then that shouldn't be what's causing your issue.

      Have you verified the settings in zabbix.conf.php are correct for your database after the PHP upgrade?

      Checking the zabbix_server.log and increasing debug logging there will prove that the server components are running and working, but it won't tell you anything about the web front end. Those logs would be in the web server access and error logs, and any PHP logs you've enabled. You may want to examine those logs to see if there's any additional information present in those.

      Comment

      • martynasj
        Junior Member
        • May 2022
        • 6

        #3

        That's correct I use httpd and also forgot to mention that selinux is set to permissive mode.
        the PHP 7.3 example is missing a "-"
        I noticed this and fixed path.
        Have you verified the settings in zabbix.conf.php are correct
        Yes it is correct before and after changing php versions.
        Those logs would be in the web server access and error logs
        I checked those with httpd debug enabled. access_log just gives events with 200 code and error_log shows that connection is established with zabbix.sock on php-fpm directory.
        Code:
        connecting fcgi://localhost/usr/share/zabbix/zabbix.php to localhost:8000, referer: https://zabbix.example.com/zabbix.php
        fcgi: has determined UDS as /var/opt/rh/rh-php73/run/php-fpm/zabbix.sock, referer: https://zabbix.example.com/zabbix.php
        connected /usr/share/zabbix/zabbix.php to httpd-UDS:0, referer: https://zabbix.example.com/zabbix.php
        connection established with Unix domain socket /var/opt/rh/rh-php73/run/php-fpm/zabbix.sock (*)
        FCGI: has released connection for (*)
        authorization result of Require all granted: granted, referer: https://zabbix.example.com/zabbix.php
        authorization result of <RequireAny>: granted, referer: https://zabbix.example.com/zabbix.php
        Running scheme unix handler (attempt 0), referer: https://zabbix.example.com/zabbix.php
        declining URL fcgi://localhost/usr/share/zabbix/zabbix.php, referer: https://zabbix.example.com/zabbix.php
        url: fcgi://localhost/usr/share/zabbix/zabbix.php proxyname: (null) proxyport: 0, referer: https://zabbix.example.com/zabbix.php
        serving URL fcgi://localhost/usr/share/zabbix/zabbix.php, referer: https://zabbix.example.com/zabbix.php
        All I'm doing to change between php versions:
        1. Change php version in SetHandler line on /etc/httpd/conf.d/zabbix.conf
        2. stop rh-php72 service
        3. start rh-php73 service
        4. restart httpd
        Result: zabbix works with php72, frontend doesn't reach database with php73.

        I tried to reinstall all zabbix-web* packages with no diference, atm I have installed these zabbix packages:
        Code:
        zabbix-agent.x86_64 5.0.8-1.el7
        zabbix-apache-conf-scl.noarch 5.0.8-4.el7
        zabbix-get.x86_64 5.0.8-1.el7
        zabbix-java-gateway.x86_64 5.0.8-4.el7
        zabbix-js.x86_64 5.0.8-1.el7
        zabbix-sender.x86_64 5.0.8-1.el7
        zabbix-server-mysql.x86_64 5.0.8-1.el7
        zabbix-web.noarch 5.0.8-4.el7
        zabbix-web-deps-scl.noarch 5.0.8-4.el7
        zabbix-web-deps-scl-php73.noarch 5.0.8-4.el7
        zabbix-web-mysql-scl.noarch 5.0.8-4.el7
        zabbix-web-mysql-scl-php73.noarch 5.0.8-4.el7
        Attached Files

        Comment

        • tim.mooney
          Senior Member
          • Dec 2012
          • 1427

          #4
          Originally posted by martynasj
          All I'm doing to change between php versions:
          1. Change php version in SetHandler line on /etc/httpd/conf.d/zabbix.conf
          2. stop rh-php72 service
          3. start rh-php73 service
          4. restart httpd
          Result: zabbix works with php72, frontend doesn't reach database with php73.
          Ok, thanks for all the info you provided.

          Since you have SCL rh-php72 and rh-php73 installed in parallel, the final thing I would recommend checking is that the 7.3 install has the same set of packages (so all the same PHP extensions), and that wherever you're setting the PHP settings needed for Zabbix (perhaps you're doing it at the pool level, or perhaps its in php.ini or php.d/some-file.ini), that both the 7.2 install and the 7.3 install have all the same settings.

          For the packages, you could do something like

          Code:
          rpm -qa --queryformat '%{NAME}\n' | egrep rh-php72 | sed -e 's/^rh-php7.//' | sort > /tmp/php72-packages.txt
          rpm -qa --queryformat '%{NAME}\n' | egrep rh-php73 | sed -e 's/^rh-php7.//' | sort > /tmp/php73-packages.txt
          diff -u /tmp/php7?-packages.txt
          That should show you if there are any package differences between the two PHP installs. Comparing the settings in the pool or php.ini/php.d/whatever.ini will probably take some manual inspection.

          Alternately, if you wanted you could use 'php -m' from each of the two SCL installs, and compare the list of modules to see if there are any differences.

          My work environment is currently 5.0.20 with rh-php72 on RHEL 7, so it's fairly similar to your starting point. My site is tracking a different problem (unrelated to the issue you're having) so I can't currently test rh-php73, but once I have some progress on the issue we're debugging, I may try upgrading my site to rh-php73. It's been on my todo list for a while.
          Last edited by tim.mooney; 10-05-2022, 01:36.

          Comment

          • martynasj
            Junior Member
            • May 2022
            • 6

            #5
            Comparing the settings in the pool or php.ini/php.d/whatever.ini will probably take some manual inspection.
            This was the issue. After manual inspection trough rh-php files I found that old rh-php72 installation had this parameters set on /etc/opt/rh/rh-php72/php.ini
            Code:
            [MySQLi]
            mysqli.default_socket = /opt/app/mysql/mysql.sock
            mysqli.default_host = localhost
            mysqli.default_user = zabbix
            mysqli.default_pw = ********
            Adding same for rh-php73 fixed the issue.

            Comment

            Working...