Go back to PHP 8.0.x. PHP 8.1 is still a bit problemmatic for WP and plugins.
I just got done rolling my own wp server from scratch and had to battle with php8.1, It was a battle for sure tracking down all my issues on a brand new install from scratch via ssh and command line only.
Anyways the issues stems from a change in error reporting. It uses a new strict error reporting format. You can change the line of code to force it to prior version format. I think it had to do with mysql connection as from my understanding wp now handles that. It was 6 hours yesterday and 2 more this morning so I am a little fuzzy.
It comes done to one simple line of code I think on line 1635. It is in a wp changelog and also on the php documentation site.
I am trying to find the issue, but if you turn on debugging in the your wp-config.php file it will give you some information. I will respond back when I find the 411.
https://core.trac.wordpress.org/ticket/52825
https://php.watch/versions/8.1/mysqli-error-mode
File to Modify:
wp-includes/wp-db.php
// Set the MySQLi error reporting off because WordPress handles
// its own. This is due to default value change in PHP 8.1.
mysqli_report( MYSQLI_REPORT_OFF );
Direct from my config file:
1631 /*
1632 * Set the MySQLi error reporting off becuase WordPress handles its own.
1633 * This is due to the defualt value change from 'MYSQLI_REPORT_OFF'
1634 * to 'MYSQLI_REPORT_ERROR|MYSQLI_REPORT_STRICT' in PHP 8.1
1635 */
1636 mysqli_report( MYSQLI_REPORT_OFF );
Also as a future note on a very similar subject, I also use MySQL 8 and I ran into a problem with errors in that there where no tables created in the database.
Again simple fix after hours of hairpulling, (hence my username)this is due to again changes in the core code of mysql 8.
When creating the database user you must use the flag ‘mysql_native_password’ when creating the wp_db user. If not wordpress will not be able to authenticate and will not be able to create tables on the database.
No explicit errors to tell you this, you just end up falling down the rabbit hole chasing leads until viola, you nail it!
Do not modify core files.
Current versions of WordPress are not compatible with PHP 8.1. The upcoming 5.9 release contains numerous fixes for PHP 8.1 compatibility. For more information:
https://core.trac.wordpress.org/ticket/53635
Thanks for all respon. I decided go back to version PHP 8.0