Failed to connect to the database on nextcloud

[details=“Support intro”]

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

I’m my way to upgrade owncloud to nextcloud and upgrade up to nextcloud 12. But after that NC 12 to 15 upgrade my website not loading and getting errors as below. can some help me? thank you

Nextcloud version : 15
Operating system and version : 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.41
PHP version (eg, 7.4): PHP 7.2.

The issue you are facing:
Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):





The output of your Apache/nginx/system log in /var/log/____:

[Wed Oct 13 11:39:40.567121 2021] [php7:notice] [pid 107777] [client 192.168.1.93:53429] {"reqId":"oMST1MoOZRm0Kev7ha6S","level":3,"time":"2021-10-12T22:39:40+00:00","remoteAddr":"192.168.1.93","user":"--","app":"index","method":"GET","url":"\\/index.php","message":{"Exception":"Doctrine\\\\DBAL\\\\DBALException","Message":"Failed to connect to the database: An exception occurred in driver: could not find driver","Code":0,"Trace":[{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/Connection.php","line":1065,"function":"connect","class":"OC\\\\DB\\\\Connection","type":"->","args":[]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/DB\\/Connection.php","line":216,"function":"executeUpdate","class":"Doctrine\\\\DBAL\\\\Connection","type":"->","args":["PRAGMA read_uncommitted = 1",[],[]]},{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/Connection.php","line":710,"function":"executeUpdate","class":"OC\\\\DB\\\\Connection","type":"->","args":["PRAGMA read_uncommitted = 1"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/DB\\/Connection.php","line":151,"function":"setTransactionIsolation","class":"Doctrine\\\\DBAL\\\\Connection","type":"->","args":[2]},{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/doctrine\\/dbal\\/lib\\/Doctrine\\/DBAL\\/DriverManager.php","line":181,"function":"__construct","class":"OC\\\\DB\\\\Connection","type":"->","args":[{"adapter":"OC\\\\DB\\\\AdapterSqlite","driver":"pdo_sqlite","wrapperClass":"OC\\\\DB\\\\Connection","user":"","password":"","path":"\\/var\\/www\\/owncloud\\/data\\/owncloud.db","tablePrefix":"oc_","sqlite.journal_mode":"WAL","defaultTableOptions":{"collate":"utf8_bin","tablePrefix":"oc_"},"platform":{"__class__":"OC\\\\DB\\\\OCSqlitePlatform"}},{"__class__":"Doctrine\\\\DBAL\\\\Driver\\\\PDOSqlite\\\\Driver"},{"__class__":"Doctrine\\\\DBAL\\\\Configuration"},{"__class__":"Doctrine\\\\Common\\\\EventManager"}]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/DB\\/ConnectionFactory.php","line":158,"function":"getConnection","class":"Doctrine\\\\DBAL\\\\DriverManager","type":"::","args":[{"adapter":"OC\\\\DB\\\\AdapterSqlite","driver":"pdo_sqlite","wrapperClass":"OC\\\\DB\\\\Connection","user":"","password":"","path":"\\/var\\/www\\/owncloud\\/data\\/owncloud.db","tablePrefix":"oc_","sqlite.journal_mode":"WAL","defaultTableOptions":{"collate":"utf8_bin","tablePrefix":"oc_"},"platform":{"__class__":"OC\\\\DB\\\\OCSqlitePlatform"}},{"__class__":"Doctrine\\\\DBAL\\\\Configuration"},{"__class__":"Doctrine\\\\Common\\\\EventManager"}]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/Server.php","line":641,"function":"getConnection","class":"OC\\\\DB\\\\ConnectionFactory","type":"->","args":["sqlite",{"user":"","password":"","path":"\\/var\\/www\\/owncloud\\/data\\/owncloud.db","tablePrefix":"oc_","sqlite.journal_mode":"WAL","defaultTableOptions":{"collate":"utf8_bin","tablePrefix":"oc_"},"platform":{"__class__":"OC\\\\DB\\\\OCSqlitePlatform"}}]},{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OCP\\\\IDBConnection"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":165,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OCP\\\\IDBConnection"]},{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":114,"function":"OC\\\\AppFramework\\\\Utility\\\\{closure}","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["DatabaseConnection"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/Server.php","line":1560,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["DatabaseConnection"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/Server.php","line":456,"function":"getDatabaseConnection","class":"OC\\\\Server","type":"->","args":[]},{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\AppConfig"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/Server.php","line":695,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\AppConfig"]},{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":118,"function":"OC\\\\{closure}","class":"OC\\\\Server","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["OC\\\\App\\\\AppManager"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/AppFramework\\/Utility\\/SimpleContainer.php","line":165,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["OC\\\\App\\\\AppManager"]},{"file":"\\/var\\/www\\/owncloud\\/3rdparty\\/pimple\\/pimple\\/src\\/Pimple\\/Container.php","line":114,"function":"OC\\\\AppFramework\\\\Utility\\\\{closure}","class":"OC\\\\AppFramework\\\\Utility\\\\SimpleContainer","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/ServerContainer.php","line":125,"function":"offsetGet","class":"Pimple\\\\Container","type":"->","args":["AppManager"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/Server.php","line":1731,"function":"query","class":"OC\\\\ServerContainer","type":"->","args":["AppManager"]},{"file":"\\/var\\/www\\/owncloud\\/lib\\/private\\/legacy\\/template.php","line":284,"function":"getAppManager","class":"OC\\\\Server","type":"->","args":[]},{"file":"\\/var\\/www\\/owncloud\\/index.php","line":51,"function":"printErrorPage","class":"OC_Template","type":"::","args":["Can't write into config directory!","This can usually be fixed by giving the webserver write access to the config directory. See https:\\/\\/docs.nextcloud.com\\/server\\/16\\/go.php?to=admin-dir_permissions",503]}],"File":"\\/var\\/www\\/owncloud\\/lib\\/private\\/DB\\/Connection.php","Line":64,"CustomMessage":"--"},"userAgent":"Mozilla\\/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit\\/537.36 (KHTML, like Gecko) Chrome\\/93.0.4577.82 Safari\\/537.36","version":""}

Sorry i do not have any experience with migrating ownCloud to Nextcloud.

But you can not directly upgrade Nextcloud 12 to 15.
I think you must upgrade all versions.

Perhaps you can better install the latest Nextcloud version.

I take it since you ended up at NC 12, that you came from OC 10.0.x.
I believe that your proper migration path from there would be to NC13 → 14 → … → 20 → 21 → 22.

Note that NC 21 and newer will require at least PHP 7.3.

yes i did the same from 10 to 12. NC 12 was worked well then i upgrade Ubuntu. after that i got DB connection error