Uncaught Error: Undefined constant "dbtable"

Discussion in 'General' started by Frans Luteijn, Mar 27, 2023.

  1. Frans Luteijn

    Frans Luteijn New Member

    Last week I've updated almost all servers to Ubuntu 22.04 LTS and to ISPConfig 3.2.9p1. On two servers, the DNS servers, I get the message in the cron.log:
    PHP Fatal error: Uncaught Error: Undefined constant "dbtable" in /usr/local/ispconfig/server/lib/classes/modules.inc.php:189
    The full trace is:

    Mon Mar 27 01:58:01 PM UTC 2023 27.03.2023-13:58 - WARNING - There is already a lockfile set, but no process running with this pid (626308). Continuing.
    Mon Mar 27 01:58:01 PM UTC 2023 Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    Mon Mar 27 01:58:01 PM UTC 2023 Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'PHP Warning: Undefined variable $state_out in /usr/local/ispconfig/server/lib/classes/plugins.inc.php on line 173
    Mon Mar 27 01:58:01 PM UTC 2023 27.03.2023-13:58 - DEBUG [server:177] - Found 13 changes, starting update process.
    Mon Mar 27 01:58:01 PM UTC 2023 PHP Fatal error: Uncaught Error: Undefined constant "dbtable" in /usr/local/ispconfig/server/lib/classes/modules.inc.php:189
    Mon Mar 27 01:58:01 PM UTC 2023 Stack trace:
    Mon Mar 27 01:58:01 PM UTC 2023 #0 /usr/local/ispconfig/server/server.php(180): modules->processDatalog()
    Mon Mar 27 01:58:01 PM UTC 2023 #1 {main}
    Mon Mar 27 01:58:01 PM UTC 2023 thrown in /usr/local/ispconfig/server/lib/classes/modules.inc.php on line 189

    On the managementserver I see the records in the database for the DNS server, which I don't see in the database on the DNS server, so replication fails.

    All required php-modules are installed:
    php-cgi php-cli php-curl php-fpm php-gd php-imap php-intl php-json php-mbstring php-mysql php-pspell php-readline php-soap php-sqlite3 php-tidy php-xml php-xmlrpc php-zip
    Running on PHP-8.1
    Following is the output of the htf-common-issues.php script:
    ##### SERVER #####
    IP-address (as per hostname): ***.***.***.***
    [WARN] could not determine server's ip address by ifconfig
    [INFO] OS version is Ubuntu 22.04.2 LTS

    [INFO] uptime: 08:44:31 up 6 days, 21:43, 2 users, load average: 0.18, 0.10, 0.02

    [INFO] memory:
    total used free shared buff/cache available
    Mem: 1.9Gi 692Mi 163Mi 6.0Mi 1.1Gi 1.1Gi
    Swap: 0B 0B 0B

    [INFO] systemd failed services status:
    UNIT LOAD ACTIVE SUB DESCRIPTION
    0 loaded units listed.

    [INFO] ISPConfig is installed.

    ##### ISPCONFIG #####
    ISPConfig version is 3.2.9p1


    ##### VERSION CHECK #####

    [INFO] php (cli) version is 8.1.2-1ubuntu2.11
    [INFO] php-cgi (used for cgi php in default vhost!) is version 8.1.2

    ##### PORT CHECK #####

    [WARN] Port 8080 (ISPConfig) seems NOT to be listening
    [WARN] Port 8081 (ISPConfig Apps) seems NOT to be listening
    [WARN] Port 443 (Webserver SSL) seems NOT to be listening
    [WARN] Port 143 (IMAP server) seems NOT to be listening
    [WARN] Port 993 (IMAP server SSL) seems NOT to be listening
    [WARN] Port 110 (POP3 server) seems NOT to be listening
    [WARN] Port 995 (POP3 server SSL) seems NOT to be listening
    [WARN] Port 25 (SMTP server) seems NOT to be listening
    [WARN] Port 465 (SMTP server SSL) seems NOT to be listening
    [WARN] Port 21 (FTP server) seems NOT to be listening
    [WARN] Port 25 (SMTP server) seems NOT to be listening

    ##### MAIL SERVER CHECK #####

    [WARN] I found no "smtp" entry in your postfix master.cf
    [WARN] I found no "submission" entry in your postfix master.cf
    [INFO] this is not critical, but if you want to offer port 587 for smtp connections you have to enable this.
    [WARN] I found no "smtps" entry in your postfix master.cf
    [INFO] this is not critical, but if you want to offer SSL for smtp (not TLS) connections you have to enable this.

    ##### RUNNING SERVER PROCESSES #####

    [INFO] I found the following web server(s):
    Apache 2 (PID 44710)
    [WARN] I could not determine which mail server is running.
    [WARN] I could not determine which pop3 server is running.
    [WARN] I could not determine which imap server is running.
    [WARN] I could not determine which ftp server is running.

    ##### LISTENING PORTS #####
    (only ()
    Local (Address)
    [localhost]:953 (898/named)
    [localhost]:953 (898/named)
    ***.***.***.***:53 (898/named)
    ***.***.***.***:53 (898/named)
    [anywhere]:22 (43682/sshd:)
    [localhost]:53 (898/named)
    [localhost]:53 (898/named)
    ***.***.***.***:53 (43735/systemd-resol)
    *:*:*:*::**:*:*:*::*53 (898/named)
    *:*:*:*::**:*:*:*::*53 (898/named)
    *:*:*:*::*:53 (898/named)
    *:*:*:*::*:53 (898/named)
    *:*:*:*::*:22 (43682/sshd:)
    *:*:*:*::*:80 (44710/apache2)
    *:*:*:*::*:3306 (939/mysqld)
    *:*:*:*::*:33060 (939/mysqld)
    *:*:*:*::*:953 (898/named)
    *:*:*:*::*:953 (898/named)

    ##### IPTABLES #####
    Chain INPUT (policy ACCEPT)
    target prot opt source destination

    Chain FORWARD (policy ACCEPT)
    target prot opt source destination

    Chain OUTPUT (policy ACCEPT)
    target prot opt source destination

    ##### LET'S ENCRYPT #####

    If I on another server, for example, change the debug level that change gets updated to that server, while the same change to the secondary DNS server is not updated.

    I've found the code in modules.inc.php where the change should be made, but I can't see where it's going wrong.

    Thanks in advance.
     
  2. till

    till Super Moderator Staff Member ISPConfig Developer

    Please post the output of the command:

    ls -la /usr/local/ispconfig/server/plugins-enabled/

    from one of the affected DNS servers.
     
  3. till

    till Super Moderator Staff Member ISPConfig Developer

    And change line 189 in the modules.inc.php file to:

    Code:
    $app->log("Replication failed. Error: (" . $d['dbtable'] . ") " . $app->db->errorMessage . " # SQL: " . $sql, LOGLEVEL_ERROR);
    and run debug again. The code issue, which must exist for many years, is not the cause of the replication failure.
     
    Last edited: Mar 27, 2023
  4. Frans Luteijn

    Frans Luteijn New Member

    Thanks for your reply.
    The output is:
    ls -la /usr/local/ispconfig/server/plugins-enabled/|more
    total 40
    drwxr-x--- 2 root root 4096 Jul 6 2021 .
    drwxr-x--- 13 root root 4096 Jul 6 2021 ..
    lrwxrwxrwx 1 root root 67 Nov 5 2018 backup_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/backup_plugin.inc.php
    lrwxrwxrwx 1 root root 65 Nov 5 2018 bind_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/bind_plugin.inc.php
    -rwxr-x--- 1 root root 45 Feb 27 15:26 empty.dir
    lrwxrwxrwx 1 root root 69 Nov 5 2018 firewall_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/firewall_plugin.inc.php
    lrwxrwxrwx 1 root root 75 Nov 5 2018 mysql_clientdb_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/mysql_clientdb_plugin.inc.php
    lrwxrwxrwx 1 root root 77 Nov 5 2018 network_settings_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/network_settings_plugin.inc.php
    lrwxrwxrwx 1 root root 76 Jul 6 2021 server_services_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/server_services_plugin.inc.php
    lrwxrwxrwx 1 root root 76 Nov 5 2018 software_update_plugin.inc.php -> /usr/local/ispconfig/server/plugins-available/software_update_plugin.inc.php
     
  5. till

    till Super Moderator Staff Member ISPConfig Developer

    Just updated my post above, missed correcting the code. dbtable must be in single quotes.
     
  6. Frans Luteijn

    Frans Luteijn New Member

    To be honest, I don't see any difference between the existing line and the new line, but replaced it anyways. The new output is:
    ./server.sh
    27.03.2023-14:59 - WARNING - There is already a lockfile set, but no process running with this pid (651806). Continuing.
    Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'PHP Warning: Undefined variable $state_out in /usr/local/ispconfig/server/lib/classes/plugins.inc.php on line 173
    27.03.2023-14:59 - DEBUG [server:177] - Found 13 changes, starting update process.
    PHP Fatal error: Uncaught Error: Undefined constant "dbtable" in /usr/local/ispconfig/server/lib/classes/modules.inc.php:190
    Stack trace:
    #0 /usr/local/ispconfig/server/server.php(180): modules->processDatalog()
    #1 {main}
    thrown in /usr/local/ispconfig/server/lib/classes/modules.inc.php on line 190
    Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'
     
  7. Frans Luteijn

    Frans Luteijn New Member

    I've put "dbtable" in single quotes now and it seems to be working now, but now another error pops up, but I know how to solve this:
    ERROR - Replication failed. Error: (dns_rr) Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation # SQL: DELETE FROM ?? WHERE ?? = ?
    The full trace is:
    Mon Mar 27 03:12:01 PM UTC 2023 Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    Mon Mar 27 03:12:01 PM UTC 2023 Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'PHP Warning: Undefined variable $state_out in /usr/local/ispconfig/server/lib/classes/plugins.inc.php on line 173
    Mon Mar 27 03:12:01 PM UTC 2023 27.03.2023-15:12 - DEBUG [server:177] - Found 13 changes, starting update process.
    Mon Mar 27 03:12:01 PM UTC 2023 27.03.2023-15:12 - ERROR - Replication failed. Error: (dns_rr) Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation # SQL: DELETE FROM ?? WHERE ?? = ?
    Mon Mar 27 03:12:02 PM UTC 2023 PHP Warning: Undefined array key "hostname" in /usr/local/ispconfig/server/lib/app.inc.php on line 324
    Mon Mar 27 03:12:02 PM UTC 2023 PHP Warning: Undefined array key "hostname" in /usr/local/ispconfig/server/lib/app.inc.php on line 324
    Mon Mar 27 03:12:02 PM UTC 2023 sh: 1: /usr/sbin/sendmail: not found
    Mon Mar 27 03:12:02 PM UTC 2023 27.03.2023-15:12 - DEBUG [modules.inc:193] - Replicated from master: DELETE FROM `dns_rr` WHERE `id` = '1580'
    Mon Mar 27 03:12:02 PM UTC 2023 27.03.2023-15:12 - ERROR - Error in Replication, changes were not processed.
    Mon Mar 27 03:12:02 PM UTC 2023 PHP Warning: Undefined array key "hostname" in /usr/local/ispconfig/server/lib/app.inc.php on line 324
    Mon Mar 27 03:12:02 PM UTC 2023 PHP Warning: Undefined array key "hostname" in /usr/local/ispconfig/server/lib/app.inc.php on line 324
    Mon Mar 27 03:12:02 PM UTC 2023 sh: 1: /usr/sbin/sendmail: not found
    Mon Mar 27 03:12:02 PM UTC 2023 27.03.2023-15:12 - DEBUG [server:217] - Remove Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    Mon Mar 27 03:12:02 PM UTC 2023 finished server.php.
    Mon Mar 27 03:13:01 PM UTC 2023 Set Lock: /usr/local/ispconfig/server/temp/.ispconfig_lock
    Mon Mar 27 03:13:01 PM UTC 2023 Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'Falsche Anfrage / Wrong Query SQL-Query = SET character_set_results = 'utf8', character_set_client = 'utf8', character_set_connection = 'utf8', character_set_database = 'utf8', character_set_server = 'utf8'PHP Warning: Undefined variable $state_out in /usr/local/ispconfig/server/lib/classes/plugins.inc.php on line 173
    Mon Mar 27 03:13:01 PM UTC 2023 27.03.2023-15:13 - DEBUG [server:177] - Found 13 changes, starting update process.
    Mon Mar 27 03:13:01 PM UTC 2023 27.03.2023-15:13 - ERROR - Replication failed. Error: (dns_rr) Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation # SQL: DELETE FROM ?? WHERE ?? = ?
    Mon Mar 27 03:13:01 PM UTC 2023 PHP Warning: Undefined array key "hostname" in /usr/local/ispconfig/server/lib/app.inc.php on line 324
    Mon Mar 27 03:13:01 PM UTC 2023 PHP Warning: Undefined array key "hostname" in /usr/local/ispconfig/server/lib/app.inc.php on line 324
    Mon Mar 27 03:13:01 PM UTC 2023 sh: 1: /usr/sbin/sendmail: not found
    Mon Mar 27 03:13:01 PM UTC 2023 27.03.2023-15:13 - DEBUG [modules.inc:193] - Replicated from master: DELETE FROM `dns_rr` WHERE `id` = '1580'
    Mon Mar 27 03:13:01 PM UTC 2023 27.03.2023-15:13 - ERROR - Error in Replication, changes were not processed.
     
  8. till

    till Super Moderator Staff Member ISPConfig Developer

    That's the root cause of the issue. The dbtable error was causing the system to be unable to log the error message.
     
  9. Frans Luteijn

    Frans Luteijn New Member

    Thanks for your replies. The two problems are solved now.
    On the SQL server I still see the following grants:
    +------------------------------------------------------------------------------------+
    | Grants for ispconfig@localhost |
    +------------------------------------------------------------------------------------+
    | GRANT USAGE ON *.* TO `ispconfig`@`localhost` |
    | GRANT SELECT, INSERT, UPDATE, DELETE ON `dbispconfig`.* TO `ispconfig`@`localhost` |
    +------------------------------------------------------------------------------------+
    Should I also expand the grants for 'ispconfig'@'localhost' to super or am I save for now?
     

Share This Page