After upgrade to OC10 :Failed to connect to the database: An exception occured in driver: could not find driver


#1

I've just upgraded my Ubuntu 14.04 OC deb install from 9 to 10.

I've moved /var/www/owncloud folder; uninstalled owncloud deb and reinstalled it. Then I've restored /data and /config folder.

Now If I launch:
sudo -u www-data php /var/www/owncloud/console.php files:scan --all

I get

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(136): Doctrine\DBAL\DriverManager::getConnection(Array, Object(Doctrine\DBAL\Configuration), Object(Doctrine\Common\EventManager))

7 /var/www/owncloud/lib/private/Server.php(461): 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(1101): OC\ServerContainer->query('DatabaseConnect...')

12 /var/www/owncloud/lib/private/Server.php(226): 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('UserManager')

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

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

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

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('UserSession')

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

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

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

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('AppManager')

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

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

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

28 /var/www/owncloud/lib/private/legacy/app.php(106): OC_App::getEnabledApps()

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

30 /var/www/owncloud/lib/base.php(994): OC::init()

31 /var/www/owncloud/console.php(57): require_once('/var/www/ownclo...')

32 {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


Internal Server Error on oC 9.0.1.3 on Synology
Update 10 impossible - databas too big
#2

ok solved linking /usr/bin/php to /usr/bin/php5.6


Internal server error, cannot connect to db
#3

Similar problem here:
I upgraded Debian from Jessie to Stretch. Still had OwnCloud Server 9 installed from Jessie.
Had the same error as you did with php7, but everything worked fine with php5.
After realizing there is no package repository for Debian 9 I uninstalled Owncloud, got rid of php5 and installed OwnCloud Server 10.0.2 from downloaded zip archive.
Unfortunately: Still the same problem.

php -m | grep pdo
gives me
pdo_mysql

If I install and enable php7.0-sqlite3 occ/owncloud seem to work ok, but I want to use MariaDB and not sqlite...

My backtrace seems to look different though:

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(992): OC\DB\Connection->connect()

1 /var/www/owncloud/lib/private/DB/Connection.php(211): Doctrine\DBAL\Connection->executeUpdate('PRAGMA read_unc...', Array, Array)

2 /var/www/owncloud/lib/composer/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(623): OC\DB\Connection->executeUpdate('PRAGMA read_unc...')

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

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

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

6 /var/www/owncloud/lib/private/Server.php(464): OC\DB\ConnectionFactory->getConnection('sqlite3', Array)

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

27 /var/www/owncloud/lib/base.php(586): OC\Server->getSession()

28 /var/www/owncloud/lib/base.php(1003): OC::init()

29 /var/www/owncloud/console.php(57): require_once('/var/www/ownclo...')

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

31 {main}

I'm especially curious about "#6" where it says something about sqlite3 ... looks like some misconfiguration in owncloud? Any hints much appreciated.


#4

Turns out the old ownCloud config survived (didn't purge the old ownCloud installation) and this had sqlite as database.

Conclusion: Maybe it could help fellow admins if you put some (more) meaningful error message in owncloud that doesn't require you to seek through a back trace to get some clue of what might actually be going on.


#5

Can you let me know how to link usr/bin/php to usr/bin/php5.6?


#6

I do not have much experience so please be patient with me.

I upgraded to owncloud X from 9.1.6 and everything was fine until I run apt-get autoremove. It uninstalled owncloud and then I installed it again by entering apt-get install owncloud and it worked fine but then I restarted the server and now nothing works and this is what I get :

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

Can anyone help. I am not sure what any of this means.


#7

the php packages are missing.
it happened to me as well, then I installed php 7 mysql , zip , curl etc and then it worked


#8

This link helped me: https://tecadmin.net/switch-between-multiple-php-version-on-ubuntu/


#9

Same here. With Debian 8, after upgrading to owncloud X, apt-get suggested to autoremove many packages (i.e. apache2 php5 mysql etc etc ). If you autoremove as suggested, you break everything. Just reinstall what you autoremoved and everything will be up and running again.
The following command might help to understand what you autoremoved.

zgrep -E "^(Remove:|Purge)" /var/log/apt/history.log*

I am just wondering how one could be promped to autoremove all that packages...


#10

Worked for me. Installed all the php* removed and it’s working now.


#11

I stopped trusting that autoremove suggestion from apt a long time ago. BTW, after a very unpleasant experience. :wink:


#12

I think you should add the version of php when you use command
for example : sudo -u www-data php7.1 occ files:scan
in the /owncloud,


#13

sudo -u www-data $(which php) occ files:scan