Web 2.9 RememberMe Undefined class constant 'MYSQL_ATTR_INIT_COMMAND'

I’ve upgrade icingaweb from latest 2.8.x to 2.9. I’ve upgrade the postgres schema with

/usr/share/icingaweb2/etc/schema/pgsql-upgrades/2.9.0.sql
Loaded Libraries
Name 	Version
icinga/icinga-php-library 	0.6.0
icinga/icinga-php-thirdparty 	0.10.0
Loaded Modules
Name 	Version
director 	1.8.0
incubator 	0.6.0
ipl 	v0.5.0
monitoring 	2.9.0
nordlicht 	1.0.0
reactbundle 	0.9.0
spring 	0.0.1 
icinga2 - The Icinga 2 network monitoring daemon (version: r2.12.4-1)

Copyright (c) 2012-2021 Icinga GmbH (https://icinga.com/)
License GPLv2+: GNU GPL version 2 or later <http://gnu.org/licenses/gpl2.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

System information:
  Platform: Debian GNU/Linux
  Platform version: 10 (buster)
  Kernel: Linux
  Kernel version: 4.19.0-17-amd64
  Architecture: x86_64

PHP 7.3.29-1~deb10u1 (cli) (built: Jul  2 2021 04:04:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.29, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.29-1~deb10u1, Copyright (c) 1999-2018, by Zend Technologies

When I try out the new function rememberme I’ve got the following Stacktrace after click Login:



Uncaught Error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in /usr/share/php/Icinga/Common/Database.php:37
Stack trace:
#0 /usr/share/php/Icinga/Web/RememberMe.php(224): Icinga\Web\RememberMe->getDb()
#1 /usr/share/icingaweb2/application/forms/Authentication/LoginForm.php(142): Icinga\Web\RememberMe->persist()
#2 /usr/share/php/Icinga/Web/Form.php(1178): Icinga\Forms\Authentication\LoginForm->onSuccess()
#3 /usr/share/icingaweb2/application/controllers/AuthenticationController.php(83): Icinga\Web\Form->handleRequest()
#4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Controllers\AuthenticationController->loginAction()
#5 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('loginAction')
#6 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#7 /usr/share/php/Icinga/Application/Web.php(304): Zend_Controller_Front->dispat

#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}()
#1 {main}

After logout there comes this stacktrace:

Uncaught Error: Undefined class constant 'MYSQL_ATTR_INIT_COMMAND' in /usr/share/php/Icinga/Common/Database.php:37
Stack trace:
#0 /usr/share/php/Icinga/Web/RememberMe.php(83): Icinga\Web\RememberMe->getDb()
#1 /usr/share/icingaweb2/application/controllers/AuthenticationController.php(111): Icinga\Web\RememberMe::fromCookie()
#2 /usr/share/icingaweb2/library/vendor/Zend/Controller/Action.php(507): Icinga\Controllers\AuthenticationController->logoutAction()
#3 /usr/share/php/Icinga/Web/Controller/Dispatcher.php(76): Zend_Controller_Action->dispatch('logoutAction')
#4 /usr/share/icingaweb2/library/vendor/Zend/Controller/Front.php(937): Icinga\Web\Controller\Dispatcher->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#5 /usr/share/php/Icinga/Application/Web.php(304): Zend_Controller_Front->dispatch(Object(Icinga\Web\Request), Object(Icinga\Web\Response))
#6 /usr/share/php/Icinga/Application/webrouter.php(107): Icinga\Application\Web->dispatch()
#7 /usr/share/icingaweb2/public/index.php(4): requ

#0 [internal function]: Icinga\Application\Web->Icinga\Application\{closure}()
#1 {main}

The table is created:

I’ve tested with Firefox ESR, Chrome, Edge

Where am I wrong or is the bug?

Thanks
Ulf

Hi,

it’s a bug. In our tests both PDO extensions are installed (MySQL and PostgreSQL) so we didn’t notice that the code always utilizes this constant, despite the database being a PostgreSQL one.

You can work around this by installing the pdo-mysql extension for PHP.

And if you don’t mind, please open an issue on Github. Thanks.

Thanks
Done: Web 2.9 RememberMe Undefined class constant ‘MYSQL_ATTR_INIT_COMMAND’ · Issue #4441 · Icinga/icingaweb2 · GitHub