WordPress.org

Make WordPress Core

#43188 closed defect (bug) (duplicate)

"Use of undefined constant" in /wp-includes/load.php under PHP 7.2

Reported by: bugnumber9 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.9.2
Component: Bootstrap/Load Keywords: reporter-feedback
Focuses: Cc:

Description

As the title says:

PHP Warning:  Use of undefined constant DB_NAME - assumed 'DB_NAME' (this will throw an Error in a future version of PHP) in .../wp-includes/load.php on line 404
PHP Warning:  Use of undefined constant DB_HOST - assumed 'DB_HOST' (this will throw an Error in a future version of PHP) in .../wp-includes/load.php on line 404
PHP Warning:  Use of undefined constant DB_USER - assumed 'DB_USER' (this will throw an Error in a future version of PHP) in .../wp-includes/load.php on line 404
PHP Warning:  Use of undefined constant DB_PASSWORD - assumed 'DB_PASSWORD' (this will throw an Error in a future version of PHP) in .../wp-includes/load.php on line 404

This pops up in PHP error log from time to time.

Change History (4)

#1 @danieltj
19 months ago

  • Keywords reporter-feedback added

This looks like the wp-config.php file is not present as those constants should always be available.

#2 @bugnumber9
19 months ago

It's a live website, so the config file is definitely there.

#3 @SergeyBiryukov
19 months ago

  • Component changed from General to Bootstrap/Load

Sounds like something on that site is calling require_wp_db() before wp-config.php is included.

Does it happen on a clean install with all plugins disabled and a default theme (Twenty Seventeen) activated?

#4 @dd32
19 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

I'm going to mark this as a duplicate of #35560 as that's the root cause.

Even though there's probably some user-code doing something strange on the install, it could also just be being triggered by a not-yet-installed (or in progress) install of WordPress and that will fix it as far as core is concerned.

Note: See TracTickets for help on using tickets.