• PHP Warning: Use of undefined constant DB_NAME – assumed ‘DB_NAME’ (this will throw an Error in a future version of PHP) in /wp-content/plugins/query-monitor/wp-content/db.php on line 140

    In the db.php file you use this
    // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
    $wpdb = new QM_DB( DB_USER, DB_PASSWORD, DB_NAME, DB_HOST );

    Should those be between ”? like…
    $wpdb = new QM_DB( ‘DB_USER’, ‘DB_PASSWORD’, ‘DB_NAME’, ‘DB_HOST’ )

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

    (@johnbillion)

    WordPress Core Developer

    Thanks. This has been reported a couple of times in the past but nobody has been able to find the cause.

    These are standard constants that are part of WordPress core. They don’t need to go inside quotes otherwise they’re treated as strings. As far as I know there’s no way to load WordPress without these constants being defined so I honestly don’t know how this error could be triggered.

    Can you provide a bit more information please?

    * On which URL do these errors get triggered? Is the error reproducible?
    * Do you have any non-standard configuration in your wp-config.php file?
    * Are you using Multisite?
    * Do you have a wp-content/sunrise.php file in place?

    Thread Starter nosaint

    (@nosaint)

    2) the wp-config is standard. I only added 2 rows
    defined(“LITESPEED_CFG_HTACCESS”) || define(“LITESPEED_CFG_HTACCESS”, “/public/.htaccess”);
    defined(“LITESPEED_CFG_HTACCESS_BACKEND”) || define(“LITESPEED_CFG_HTACCESS_BACKEND”, “public/.htaccess”);

    3) NOT multisite
    4) No sunsrise.php file in wp-content

    Plugin Author John Blackbourn

    (@johnbillion)

    WordPress Core Developer

    Are you able to determine which URLs or requests trigger this error? That’s the missing piece of information that nobody has been able to narrow down yet.

    I compared my error log with access log and it appears this happens when someone accesses…
    /wp-admin/setup-config.php

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Use of undefined constant DB_NAME – assumed ‘DB_NAME’’ is closed to new replies.