How to use mysqli::debug with error_log() to record custom logs to help debug MySQL connection problems?
Debugging MySQL database connections is often a challenge when developing PHP applications. Especially in complex projects, it is important to track database connection errors, SQL execution issues, or other database-related exceptions. To help developers better debug, PHP provides mysqli extensions and some convenient logging tools such as mysqli::debug and error_log().
mysqli::debug