Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 2 years ago

#55576 closed defect (bug) (invalid)

DB connection fail on every computer restart

Reported by: mattscott's profile matt.scott Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.9.3
Component: Database Keywords:
Focuses: administration Cc:

Description

I have a local installation. Each time I switch on the computer, Safari reloads my last visited. Mostly the last page, before shutdown, is the admin of my development site. Each time this site appears and says 'Error establishing a database connection', I then press reload and then no problems any more... I never worried about this as there is a easy solution.
Then I noticed the below in the debug.log:

[14-Apr-2022 14:04:38 UTC] PHP Fatal error: Uncaught Error: Call to undefined function mysql_connect() in .../wp-includes/ wp-db.php:1785
1402 Stack trace:
1403 #0 .../wp-includes/wp-db.php(724): wpdb->db_connect()
1404 #1 .../wp-includes/load.php(561): wpdb->construct('...', '...', '...', '127.0.0.1')
1405 #2 .../wp-settings.php(124): require_wp_db()
1406 #3 .../wp-config.php(121): require_once('/Users/Yuma/Dev...')
1407 #4 .../wp-load.php(50): require_once('/Users/Yuma/Dev...')
1408 #5 .../wp-admin/admin.php(34): require_once('/Users/Yuma/Dev...')
1409 #6 .../wp-admin/edit.php(10): require_once('/Users/Yuma/Dev...')
1410 #7 {main}
1411 thrown in .../wp-includes/wp-db.php on line 1785

That seems very unlikely that WordPress made a PHP Fatal Error. I haven't noticed this error in Chrome. Maybe it's only a Safari problem. My feeling is that MacOS shutdown by ending PHP, then my installation tries to inform the database and finds no PHP functions.

Change History (5)

This ticket was mentioned in Slack in #core by pbiron. View the logs.


3 years ago

#2 @afragen
3 years ago

I see this too when I restart LocaWP on MacOS. Other than adding something to the error log, I don't think there's real any real effect or issue. I think it has more to do with the browser trying to load the site when the local environment isn't completely loaded and throwing an error.

#3 @ironprogrammer
3 years ago

Agreed. This isn't a "bug" so much as a temporary WP error state as the environment spins up.

For comparison, I had both Safari and Chrome opened to a WP page, and after reboot, my local install (Laravel Valet + DBngin) logged the same error. Errors were logged for both browsers as they attempted to reload the pages. Chrome lagged a little behind Safari, but when I waited long enough, it tried (and failed) as well.

After starting DBngin, the error went away for subsequent page loads.

#4 @markparnell
3 years ago

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

Per @afragen and @ironprogrammer's comments, this doesn't sound like an issue with WordPress as such, just the natural result of trying to load a page before the system is fully initialised. As such I'm going to close this issue.

#5 @SergeyBiryukov
2 years ago

  • Component changed from General to Database
Note: See TracTickets for help on using tickets.