Support » Plugin: Query Monitor » PHP Error

  • Hi There!

    We are using

    QueryMonitor Version 3.6.5
    WordPress Version 5.5.3
    PHP Version 7.4.11 (64bit)

    and we got the following warning every day at our error log:

    [26-Nov-2020 06:08:08 UTC] PHP Warning: Invalid argument supplied for foreach() in /kunden/xxx/webseiten/hello-world.net/wordpress/wp-content/plugins/contact-form-7-mailchimp-extension/lib/deactivate.php on line 219
    [26-Nov-2020 10:48:02 UTC] PHP Warning: Use of undefined constant DB_USER – assumed ‘DB_USER’ (this will throw an Error in a future version of PHP) in /kunden/xxx/webseiten/hello-world.net/wordpress/wp-content/plugins/query-monitor/wp-content/db.php on line 139
    [26-Nov-2020 10:48:02 UTC] PHP Warning: Use of undefined constant DB_PASSWORD – assumed ‘DB_PASSWORD’ (this will throw an Error in a future version of PHP) in /kunden/xxx/webseiten/hello-world.net/wordpress/wp-content/plugins/query-monitor/wp-content/db.php on line 139
    [26-Nov-2020 10:48:02 UTC] PHP Warning: Use of undefined constant DB_NAME – assumed ‘DB_NAME’ (this will throw an Error in a future version of PHP) in /kunden/xxx/webseiten/hello-world.net/wordpress/wp-content/plugins/query-monitor/wp-content/db.php on line 139
    [26-Nov-2020 10:48:02 UTC] PHP Warning: Use of undefined constant DB_HOST – assumed ‘DB_HOST’ (this will throw an Error in a future version of PHP) in /kunden/xxx/webseiten/hello-world.net/wordpress/wp-content/plugins/query-monitor/wp-content/db.php on line 139

    thnx for helping to get rid off this warning

    Nick

    The page I need help with: [log in to see the link]

Viewing 10 replies - 1 through 10 (of 10 total)
  • Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Thanks for the report. This error has been reported a few times but I do not know under which condition it can occur.

    The db.php file only loads after wp-config.php loads, and if you don’t have those DB_ constants in place then your database connection will fail. So there should not be a path that loads this file without those constants, but maybe there is.

    Can you let me know which plugins you have installed and active please? I can only assume that one of them might be doing something weird with manually loading the wp-content/db.php file.

    Thread Starter Nico Marcuz

    (@nick7766)

    Thnx for your reply John. I dont want to post our pluginlist here. If you can send send me a private eMail adress or something like that, I will send it to you.

    best regards
    Nick

    I’m getting the “undefined constant” issue in db.php as well. Is it preferable that I start a new thread for it or can I post the error log and seek troubleshooting in this one? Thanks.

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    @freshpromo an error log and list of your active plugins would be very helpful, thanks!

    [Dec 03, 16:16:03] PHP Warning: Use of undefined constant DB_USER – assumed ‘DB_USER’ (this will throw an Error in a future version of PHP) in /home/mydomain/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 139
    [Dec 03, 16:16:03] PHP Warning: Use of undefined constant DB_PASSWORD – assumed ‘DB_PASSWORD’ (this will throw an Error in a future version of PHP) in /home/mydomain/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 139
    [Dec 03, 16:16:03] PHP Warning: Use of undefined constant DB_NAME – assumed ‘DB_NAME’ (this will throw an Error in a future version of PHP) in /home/mydomain/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 139
    [Dec 03, 16:16:03] PHP Warning: Use of undefined constant DB_HOST – assumed ‘DB_HOST’ (this will throw an Error in a future version of PHP) in /home/mydomain/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 139

    Active plugins:

    Akismet Anti-Spam
    Child Theme Configurator
    Classic Editor
    Disqus for WordPress
    Enhanced Media Library
    Error Log Monitor
    External Links
    Formidable Forms
    Health Check & Troubleshooting
    iframe
    MC4WP: Mailchimp for WordPress
    reCaptcha by BestWebSoft
    Sucuri Security – Auditing, Malware Scanner and Hardening
    Table Sorter
    TablePress
    Twitter
    WP Force SSL
    WP SEO Structured Data Schema
    WPBakery Page Builder
    Yoast SEO

    This might be unrelated, but I noticed that there’s another db.php file in public_html/wp-content/ It’s locked but has 777 file permissions. No idea why that’s there. Is that normal?

    Thread Starter Nico Marcuz

    (@nick7766)

    @johnbillion ok, we have also installed the plugins

    Classic Editor
    TablePress
    Yoast SEO

    and we have also a db.php file at /wp-content/ with a 777 file permissions

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    @nick7766 @freshpromo Thanks for the info. I’ve been testing various plugins in your lists and haven’t seen this error occur yet.

    Do you have any idea when this error appears? eg. does it appear when viewing a certain page or performing a certain action?

    @johnbillion I checked the website logs. The last time I got a php warning, it happened at the same timestamp as what looks like a bot connection:

    168.119.51.159 – – [14/Dec/2020:05:54:12 -0600] “GET /robots.txt HTTP/1.1” 200 69 “-” “Mozilla/5.0 (compatible; um-IC/1.0; mailto: techinfo@ubermetrics-technologies.com; Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1”
    168.119.51.159 – – [14/Dec/2020:05:54:13 -0600] “GET /category/analysis/feed/ HTTP/1.1” 200 47718 “-” “Mozilla/5.0 (compatible; um-IC/1.0; mailto: techinfo@ubermetrics-technologies.com; Windows NT 6.1; WOW64; rv:40.0) Gecko/20100101 Firefox/40.1”
    185.224.138.46 – – [14/Dec/2020:05:57:12 -0600] “POST /xmlrpc.php HTTP/1.1” 200 403 “-” “Mozilla/5.0 (Linux; Android 5.1.1; vivo X7 Build/LMY47V; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/48.0.2564.116 Mobile Safari/537.36 baiduboxapp/8.6.5 (Baidu; P1 5.1.1) wp-android/16.2”

    But the last couple PHP warnings before this one did not coincide with any other action, so the bot connection may be meaningless.

    It’s probably not Theme related either, as I’ve gotten the warnings while using multiple themes – Newspaper (Pro) and Donovan (free).

    Thanks for looking into this. If you can’t solve it no worries, as it’s not a major problem for my site.

    @johnbillion update: I got the warning again today, a couple hours after doing some tasks in WP.

    – Logged out of my account and then back in
    – Ran an SEO scan using the Yoast plugin
    – In the Disqus plugin, clicked Manually Sync Comments under the Sync tab
    – Moved a draft Page to the trash

    Given the two hour gap between these and the warning, I’m not sure this is meaningful, but wanted to share. Cheers.

    [04-Mar-2021 06:45:36 UTC] PHP Warning:  Use of undefined constant DB_USER - assumed 'DB_USER' (this will throw an Error in a future version of PHP) in /home/sakurajav/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 140
    [04-Mar-2021 06:45:36 UTC] PHP Warning:  Use of undefined constant DB_PASSWORD - assumed 'DB_PASSWORD' (this will throw an Error in a future version of PHP) in /home/sakurajav/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 140
    [04-Mar-2021 06:45:36 UTC] PHP Warning:  Use of undefined constant DB_NAME - assumed 'DB_NAME' (this will throw an Error in a future version of PHP) in /home/sakurajav/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 140
    [04-Mar-2021 06:45:36 UTC] PHP Warning:  Use of undefined constant DB_HOST - assumed 'DB_HOST' (this will throw an Error in a future version of PHP) in /home/sakurajav/public_html/wp-content/plugins/query-monitor/wp-content/db.php on line 140

    My Plugin list:

    All in One SEO
    Disable Feeds
    Fix Duplicates
    Jetpack by WordPress.com
    MainWP Child
    Query Monitor
    Remove Category URL
    WP-PostRatings
    WPS Hide Login

    line 140 on query-monitor/wp-content/db.php:

    $wpdb = new QM_DB( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );

    The error says: assumed ‘DB_USER’

    So, this line should have quotes on each DB_ ???

    Thanks.

    • This reply was modified 4 months, 3 weeks ago by El Tio Rufi.
    • This reply was modified 4 months, 3 weeks ago by El Tio Rufi.
Viewing 10 replies - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.