Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54883 closed defect (bug) (duplicate)

"Table 'wp_options' doesn't exist" error thrown when installing WordPress on PHP 8.1.

Reported by: maythamalsudany's profile maythamalsudany Owned by:
Milestone: Priority: normal
Severity: normal Version: 5.8.3
Component: Upgrade/Install Keywords: php81
Focuses: Cc:

Description

When using PHP 8.1, the following error is thrown after configuring the database credentials (editing wp-config.php, or using the installer):

PHP Fatal error:  Uncaught mysqli_sql_exception: Table 'mysite.wp_options' doesn't exist in .../wp-includes/wp-db.php:2056
Stack trace:
#0 .../wp-includes/wp-db.php(2056): mysqli_query(Object(mysqli), 'SELECT option_n...')
#1 .../wp-includes/wp-db.php(1945): wpdb->_do_query('SELECT option_n...')
#2 .../wp-includes/wp-db.php(2695): wpdb->query('SELECT option_n...')
#3 .../wp-includes/option.php(284): wpdb->get_results('SELECT option_n...')
#4 .../wp-includes/functions.php(1730): wp_load_alloptions()
#5 .../wp-includes/load.php(752): is_blog_installed()
#6 .../wp-settings.php(159): wp_not_installed()
#7 .../wp-config.php(78): require_once('/Users/maythama...')
#8 .../wp-load.php(50): require_once('/Users/maythama...')
#9 .../wp-blog-header.php(13): require_once('/Users/maythama...')
#10 .../index.php(17): require('/Users/maythama...')
#11 {main}
  thrown in .../wp-includes/wp-db.php on line 2056

Reverting to PHP 8.0 fixes the problem though.

Change History (4)

#1 @SergeyBiryukov
3 years ago

  • Keywords php81 added

#2 @costdev
3 years ago

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

Duplicate of #52825.

Fixed in [51582].

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

#3 @hellofromTonya
3 years ago

Hello @maythamalsudany,

Welcome to WordPress Core's Trac! Thank you for this ticket.

As @costdev noted, this issue is fixed in WordPress 5.9 release (releasing on 25 Jan 2022). See #52825.

In PHP 8.1, the default error handling of MySQLi extension changed from silent to fatal error. This is fixed in 5.9 by turning off error reporting as Core has its own error reporting and graceful handling of database errors.

For more information:

This ticket was mentioned in Slack in #core-test by costdev. View the logs.


3 years ago

Note: See TracTickets for help on using tickets.