Autoupgrade prestashop 1.7.8.8 to 8.1.7 – how to solve error with “upgradeDB” step?

I try to upgrade Prestashop from 1.7.8.8 to 8.1.7. I decided to use autoupgrade via cli option. I got an error (I have many more but finally resolved them but stuck here):

INFO - 506 files left to upgrade.
INFO - === Step upgradeFiles
INFO - 106 files left to upgrade.
INFO - === Step upgradeFiles
INFO - All files upgraded. Now upgrading database...
INFO - Restart requested. Please run the following command to continue your upgrade:
INFO - $ modules/autoupgrade/cli-upgrade.php --dir=admin9254z9q7u --action=upgradeDb --data=eyJlcnJvciI6bnVsbCwic3RlcERvbmUiOmZhbHNlLCJuZXh0IjoidXBncmFkZUZpbGVzIiwic3RhdHVzIjoib2siLCJuZXh0X2Rlc2MiOiJJTkZPIC0gUmVzdGFydCByZXF1ZXN0ZWQuIFBsZWFzZSBydW4gdGhlIGZvbGxvd2luZyBjb21tYW5kIHRvIGNvbnRpbnVlIHlvdXIgdXBncmFkZTpcbiIsIm5leHRRdWlja0luZm8iOltdLCJuZXh0RXJyb3JzIjpbXSwibmV4dFBhcmFtcyI6eyJvcmlnaW5WZXJzaW9uIjoiMS43LjguOCIsIml [..]
INFO - === Step upgradeDb
INFO - Cleaning file cache
INFO - Running opcache_reset
PrestaShopException in /var/www/presta_us_klon/classes/db/Db.php line 303
#0 /var/www/presta_us_klon/classes/db/Db.php(236): DbCore::getClass()
#1 /var/www/presta_us_klon/config/alias.php(47): DbCore::getInstance()
#2 /var/www/presta_us_klon/classes/shop/Shop.php(1351): pSQL()
#3 /var/www/presta_us_klon/classes/shop/Shop.php(351): ShopCore::findShopByHost()
#4 /var/www/presta_us_klon/config/config.inc.php(117): ShopCore::initialize()
#5 /var/www/presta_us_klon/modules/autoupgrade/classes/UpgradeContainer.php(665): require_once('...')
#6 /var/www/presta_us_klon/modules/autoupgrade/classes/Task/AbstractTask.php(165): PrestaShopModuleAutoUpgradeUpgradeContainer->initPrestaShopCore()
#7 /var/www/presta_us_klon/modules/autoupgrade/classes/Task/Upgrade/UpgradeDb.php(90): PrestaShopModuleAutoUpgradeTaskAbstractTask->init()
#8 /var/www/presta_us_klon/modules/autoupgrade/classes/Task/Runner/ChainedTasks.php(59): PrestaShopModuleAutoUpgradeTaskUpgradeUpgradeDb->init()
#9 /var/www/presta_us_klon/modules/autoupgrade/cli-upgrade.php(50): PrestaShopModuleAutoUpgradeTaskRunnerChainedTasks->run()
#10 {main}

which is related with this class

    public static function getClass()
    {
        $class = '';
        if (PHP_VERSION_ID >= 50200 && extension_loaded('pdo_mysql')) {
            $class = 'DbPDO';
        } elseif (extension_loaded('mysqli')) {
            $class = 'DbMySQLi';
        }

        if (empty($class)) {
            throw new PrestaShopException('Cannot select any valid SQL engine.');
        }

        return $class;
    }

but as you can see I have both php7.4 extensions:

root@joffrey:/var/www# php7.4 -m | grep pdo_mysql
pdo_mysql
root@joffrey:/var/www# php7.4 -m | grep mysqli
mysqli
root@joffrey:/var/www/presta_us_klon# cat testy.php
<?php
print_r(get_loaded_extensions());
?>
root@joffrey:/var/www/presta_us_klon# php7.4 testy.php | grep -i 'mysqli|pdo_mysql'
    [33] => mysqli
    [34] => pdo_mysql