Failed to connect to the database after manual upgrade

Hello to all,
I think I made a big mistake when I wanted to upgrade my owncloud installation. Version was 10.8.0.4
First, I tried to upgrade from the web interface, but it didn’t go to the end, there was an error.
When I tried to refresh the web page, it said to upgrade php version from 7.2 to 7.3
That’s what I did on the server side.
Then, I tried to open again the web interface, and there was a blank page.
So, I decided to do a manual upgrade.
So now, when I come to the last step sudo -u www-data php occ upgrade, there is this error:

An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /var/www/owncloud/lib/private/DB/Connection.php:62
Stack trace:
#0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(474): OC\DB\Connection->connect()
#1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(436): Doctrine\DBAL\Connection->getDatabasePlatformVersion()
#2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(378): Doctrine\DBAL\Connection->detectDatabasePlatform()
#3 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(843): Doctrine\DBAL\Connection->getDatabasePlatform()
#4 /var/www/owncloud/lib/private/DB/Connection.php(148): Doctrine\DBAL\Connection->setTransactionIsolation(2)
#5 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(260): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDO\MySQL\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#6 /var/www/owncloud/lib/private/DB/ConnectionFactory.php(139): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))
#7 /var/www/owncloud/lib/private/Server.php(552): OC\DB\ConnectionFactory->getConnection('mysql', Array)
#8 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}(Object(OC\Server))
#9 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('DatabaseConnect...')
#10 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')
#11 /var/www/owncloud/lib/private/Server.php(1260): OC\ServerContainer->query('DatabaseConnect...')
#12 /var/www/owncloud/lib/private/Server.php(424): OC\Server->getDatabaseConnection()
#13 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}(Object(OC\Server))
#14 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppConfig')
#15 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppConfig')
#16 /var/www/owncloud/lib/private/Server.php(1190): OC\ServerContainer->query('AppConfig')
#17 /var/www/owncloud/lib/private/Server.php(607): OC\Server->getAppConfig()
#18 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(122): OC\Server->OC\{closure}(Object(OC\Server))
#19 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(108): Pimple\Container->offsetGet('AppManager')
#20 /var/www/owncloud/lib/private/ServerContainer.php(86): OC\AppFramework\Utility\SimpleContainer->query('AppManager')
#21 /var/www/owncloud/lib/private/Server.php(1458): OC\ServerContainer->query('AppManager')
#22 /var/www/owncloud/lib/private/legacy/app.php(344): OC\Server->getAppManager()
#23 /var/www/owncloud/lib/private/legacy/app.php(108): OC_App::getEnabledApps()
#24 /var/www/owncloud/lib/base.php(590): OC_App::loadApps(Array)
#25 /var/www/owncloud/lib/base.php(1070): OC::init()
#26 /var/www/owncloud/console.php(74): require_once('/var/www/ownclo...')
#27 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')
#28 {main}

Can you help me please ?

Here more information about my system:

lsb_release -a
No LSB modules are available.
Distributor ID:	Ubuntu
Description:	Ubuntu 18.04.6 LTS
Release:	18.04
Codename:	bionic
php -v
PHP 7.3.33-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Nov 19 2021 06:24:43) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.33, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.33-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies
mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 371849
Server version: 5.7.37-0ubuntu0.18.04.1 (Ubuntu)
apache2 -v
Server version: Apache/2.4.29 (Ubuntu)
Server built:   2022-03-16T16:53:42

Thanks a lot in advance.

dpkg -l | grep php

Check that you installed all the same PHP modules for PHP 7.3 as you had for 7.2.
I’d recommend to upgrade to 7.4 straight away, it will save you from having to upgrade again soon.

1 Like

Hello Eneubauer,
Indeed, you’re right.
Yesterday evening I reinstalled my precending Owncloud version, then I removed all php packages. For that I used the sudo apt-get purge 'php*' command… I read later that this could be dangerous… Then, installed a fresh php 7.4. It didn’t work at the first place, so I installed additional php modules until it worked.
The server and Owncloud are working again since then, I didn’t notice a problem for now… I hope it will go on.
So thanks a lot for your help.

Pascal

Just for information:

~$ dpkg -l | grep php
ii  libapache2-mod-php7.4                  7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        server-side, HTML-embedded scripting language (Apache 2 module)
rc  libapache2-mod-php8.1                  8.1.5-1+ubuntu18.04.1+deb.sury.org+1            amd64        server-side, HTML-embedded scripting language (Apache 2 module)
ii  php-common                             2:92+ubuntu18.04.1+deb.sury.org+2               all          Common files for PHP packages
ii  php7.4                                 7.4.29-1+ubuntu18.04.1+deb.sury.org+1           all          server-side, HTML-embedded scripting language (metapackage)
ii  php7.4-cgi                             7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        server-side, HTML-embedded scripting language (CGI binary)
ii  php7.4-cli                             7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        command-line interpreter for the PHP scripting language
ii  php7.4-common                          7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        documentation, examples and common module for PHP
ii  php7.4-curl                            7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        CURL module for PHP
ii  php7.4-gd                              7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        GD module for PHP
ii  php7.4-igbinary                        3.2.6+2.0.8-6+ubuntu18.04.1+deb.sury.org+10     amd64        igbinary PHP serializer
ii  php7.4-intl                            7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        Internationalisation module for PHP
ii  php7.4-json                            7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        JSON module for PHP
ii  php7.4-mbstring                        7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        MBSTRING module for PHP
ii  php7.4-mysql                           7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        MySQL module for PHP
ii  php7.4-opcache                         7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        Zend OpCache module for PHP
ii  php7.4-readline                        7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        readline module for PHP
ii  php7.4-redis                           5.3.6+4.3.0-1+ubuntu18.04.1+deb.sury.org+1      amd64        PHP extension for interfacing with Redis
ii  php7.4-xml                             7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        DOM, SimpleXML, XML, and XSL module for PHP
ii  php7.4-zip                             7.4.29-1+ubuntu18.04.1+deb.sury.org+1           amd64        Zip module for PHP