Doctrine\DBAL\DBALException failes do connect to the database


#1

Steps to reproduce

  1. Error 404 received when trying to log to owncloud
  2. No occ in /var/www/owncloud/
  3. backups of config/ and data/ folder done.
  4. backup of the database (mysql) done.
  5. force reinstallation of owncloud though sudo apt-get install owncloud-files
  6. config/ & data/ folders copied back
  7. try occ upgrade

Expected behaviour

Owncloud running as it used to do.

Actual behaviour

I receive this error message that I do not understand.
I found other topic with that error but I do not have understood how to fix it yet.

An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/owncloud/lib/private/DB/Connection.php:63
Stack trace:

0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()

1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()

2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()

3 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()

4 /var/www/owncloud/lib/private/DB/Connection.php(146): Doctrine\DBAL\Connection->setTransactionIsolation(2)

5 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))

6 /var/www/owncloud/lib/private/DB/ConnectionFactory.php(140): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))

7 /var/www/owncloud/lib/private/Server.php(472): OC\DB\ConnectionFactory->getConnection('mysql', Array)

8 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))

9 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('DatabaseConnect...')

10 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('DatabaseConnect...')

11 /var/www/owncloud/lib/private/Server.php(1121): OC\ServerContainer->query('DatabaseConnect...')

12 /var/www/owncloud/lib/private/Server.php(233): OC\Server->getDatabaseConnection()

13 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))

14 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('AccountMapper')

15 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AccountMapper')

16 /var/www/owncloud/lib/private/Server.php(973): OC\ServerContainer->query('AccountMapper')

17 /var/www/owncloud/lib/private/Server.php(238): OC\Server->getAccountMapper()

18 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))

19 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('UserManager')

20 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('UserManager')

21 /var/www/owncloud/lib/private/Server.php(966): OC\ServerContainer->query('UserManager')

22 /var/www/owncloud/lib/private/Server.php(278): OC\Server->getUserManager()

23 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))

24 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('UserSession')

25 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('UserSession')

26 /var/www/owncloud/lib/private/Server.php(990): OC\ServerContainer->query('UserSession')

27 /var/www/owncloud/lib/private/Server.php(518): OC\Server->getUserSession()

28 /var/www/owncloud/lib/composer/pimple/pimple/src/Pimple/Container.php(113): OC\Server->OC{closure}(Object(OC\Server))

29 /var/www/owncloud/lib/private/AppFramework/Utility/SimpleContainer.php(111): Pimple\Container->offsetGet('AppManager')

30 /var/www/owncloud/lib/private/ServerContainer.php(87): OC\AppFramework\Utility\SimpleContainer->query('AppManager')

31 /var/www/owncloud/lib/private/Server.php(1311): OC\ServerContainer->query('AppManager')

32 /var/www/owncloud/lib/private/legacy/app.php(313): OC\Server->getAppManager()

33 /var/www/owncloud/lib/private/legacy/app.php(107): OC_App::getEnabledApps()

34 /var/www/owncloud/lib/base.php(579): OC_App::loadApps(Array)

35 /var/www/owncloud/lib/base.php(1013): OC::init()

36 /var/www/owncloud/console.php(64): require_once('/var/www/ownclo...')

37 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')

38 {main}PHP Fatal error: Uncaught Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/owncloud/lib/private/DB/Connection.php:63

Stack trace:

0 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(429): OC\DB\Connection->connect()

1 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(389): Doctrine\DBAL\Connection->getDatabasePlatformVersion()

2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(328): Doctrine\DBAL\Connection->detectDatabasePlatform()

3 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): Doctrine\DBAL\Connection->getDatabasePlatform()

4 /var/www/owncloud/lib/private/DB/Connection.php(146): Doctrine\DBAL\Connection->setTransactionIsolation(2)

5 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/DriverManager.php(172): OC\DB\Connection->__construct(Array, Object(Doctrine\DBAL\Driver\PDOMySql\Driver), Object(Doctrine\D in /var/www/owncloud/lib/private/DB/Connection.php on line 63

Server configuration

Operating system: Ubuntu 16.04

Web server: apache2

Database: mysql

PHP version: php7.0

ownCloud version: (see ownCloud admin page)

Updated from an older ownCloud or fresh install: older owncloud

Where did you install ownCloud from: apt-get install owncloud-files

Signing status (ownCloud 9.0 and above): owncloud 10.0

Login as admin user into your ownCloud and access 
http://example.com/index.php/settings/integrity/failed 
paste the results into https://gist.github.com/ and puth the link here.

The content of config/config.php:

Log in to the web-UI with an administrator account and click on
'admin' -> 'Generate Config Report' -> 'Download ownCloud config report'
This report includes the config.php settings, the list of activated apps
and other details in a well sanitized form.

or 

If you have access to your command line run e.g.:
sudo -u www-data php occ config:list system
from within your ownCloud installation folder

*ATTENTION:* Do not post your config.php file in public as is. Please use one of the above
methods whenever possible. Both, the generated reports from the web-ui and from occ config:list
consistently remove sensitive data. You still may want to review the report before sending.
If done manually then it is critical for your own privacy to dilligently
remove *all* host names, passwords, usernames, salts and other credentials before posting.
You should assume that attackers find such information and will use them against your systems.

List of activated apps:

If you have access to your command line run e.g.:
sudo -u www-data php occ app:list
from within your ownCloud installation folder.

Are you using external storage, if yes which one: local/smb/sftp/...

Are you using encryption: yes/no

Are you using an external user-backend, if yes which one: LDAP/ActiveDirectory/Webdav/...

LDAP configuration (delete this part if not used)

With access to your command line run e.g.:
sudo -u www-data php occ ldap:show-config
from within your ownCloud installation folder

Without access to your command line download the data/owncloud.db to your local
computer or access your SQL server remotely and run the select query:
SELECT * FROM `oc_appconfig` WHERE `appid` = 'user_ldap';


Eventually replace sensitive data as the name/IP-address of your LDAP server or groups.

Client configuration

Browser:

Operating system:

Logs

Web server error log

Insert your webserver log here

ownCloud log (data/owncloud.log)

Insert your ownCloud log here

Browser log

Insert your browser log here, this could for example include:

a) The javascript console log
b) The network log 
c) ...

#2

please run php -m and paste the output


#3

Here is the output of php -m:
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
openssl
pcntl
pcre
PDO
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

[Zend Modules]
Zend OPcache


#4

no mysql module -> it cannot connect.


#5

Oh i see...

After a apt-get install php-mysql i have now:
[PHP Modules]
calendar
Core
ctype
date
exif
fileinfo
filter
ftp
gettext
hash
iconv
json
libxml
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_mysql
Phar
posix
readline
Reflection
session
shmop
sockets
SPL
standard
sysvmsg
sysvsem
sysvshm
tokenizer
Zend OPcache
zlib

[Zend Modules]
Zend OPcache


#6

Now trying again sudo -u www-data php occ, I receive this message:
Error: Call to undefined function OC\App\simplexml_load_file() in /var/www/owncloud/lib/private/App/InfoParser.php:41
Stack trace:

0 /var/www/owncloud/lib/private/legacy/app.php(683): OC\App\InfoParser->parse('/var/www/ownclo...')

1 /var/www/owncloud/lib/private/AppFramework/App.php(53): OC_App::getAppInfo('files')

2 /var/www/owncloud/lib/private/legacy/app.php(195): OC\AppFramework\App::buildAppNamespace('files')

3 /var/www/owncloud/lib/private/legacy/app.php(113): OC_App::registerAutoloading('files', '/var/www/ownclo...')

4 /var/www/owncloud/lib/base.php(579): OC_App::loadApps(Array)

5 /var/www/owncloud/lib/base.php(1013): OC::init()

6 /var/www/owncloud/console.php(64): require_once('/var/www/ownclo...')

7 /var/www/owncloud/occ(11): require_once('/var/www/ownclo...')


#7

Looks like you're again missing another PHP module/extension. A google search for this could give you some pointers which one you need to install


#8

Please read up our docs where we explain which modules are required. THX