Uploaded image for project: 'phpBB3'
  1. phpBB3
  2. PHPBB3-17232

Improve MySQL error messages in PHP 8.1+

    XMLWordPrintable

Details

    Description

      Under PHP 7, when there's an error connecting to the database (after install), you getting the following kind of error message:

      General Error
      SQL ERROR [ mysqli ]

      Access denied for user 'root'@'172.20.0.2' (using password: YES) [1045]

      An sql error occurred while fetching this page. Please contact an administrator if this problem persists.

      On PHP 8.1 and 8.2, you instead get the following:

      Fatal error: Uncaught Error: mysqli object is not fully initialized in /var/www/html/phpbb/db/driver/mysqli.php:200
      Stack trace:
      #0 /var/www/html/phpbb/db/driver/mysqli.php(200): mysqli_query(Object(mysqli), 'SELECT config_n...')
      #1 /var/www/html/phpbb/db/driver/factory.php(353): phpbb\db\driver\mysqli->sql_query('SELECT config_n...', 0)
      #2 /var/www/html/phpbb/config/db.php(86): phpbb\db\driver\factory->sql_query('SELECT config_n...')
      #3 /var/www/html/phpbb/config/db.php(55): phpbb\config\db->initialise(Object(phpbb\cache\driver\file))
      #4 [internal function]: phpbb\config\db->__construct(Object(phpbb\db\driver\factory), Object(phpbb\cache\driver\file), 'phpbb_config')
      #5 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(1176): ReflectionClass->newInstanceArgs(Array)
      #6 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(634): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), Array, true, 'config')
      #7 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(1281): Symfony\Component\DependencyInjection\ContainerBuilder->doGet('config', 1, Array, true)
      #8 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(1238): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Object(Symfony\Component\DependencyInjection\Reference), Array, true)
      #9 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(1149): Symfony\Component\DependencyInjection\ContainerBuilder->doResolveServices(Array, Array, true)
      #10 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(634): Symfony\Component\DependencyInjection\ContainerBuilder->createService(Object(Symfony\Component\DependencyInjection\Definition), Array, true, 'cache')
      #11 /var/www/html/vendor/symfony/dependency-injection/ContainerBuilder.php(588): Symfony\Component\DependencyInjection\ContainerBuilder->doGet('cache', 1)
      #12 /var/www/html/includes/compatibility_globals.php(45): Symfony\Component\DependencyInjection\ContainerBuilder->get('cache')
      #13 /var/www/html/common.php(154): register_compatibility_globals() #14 /var/www/html/index.php(23): include('/var/www/html/c...')
      #15
      Unknown macro: {main}
      thrown in /var/www/html/phpbb/db/driver/mysqli.php on line 200

      Those errors come from installing phpBB and then changing the database password in config.php to an incorrect one.

       

      The PHP 8 error messages are a bit difficult to decipher and unclear as to the actual problem.

      Attachments

        Activity

          People

            Marc Marc
            Noxwizard Patrick Webster
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: