NextCloud stable28 branch causing "Driver not found" errors on access

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:

Nextcloud version (eg, 20.0.5): 28
Operating system and version (eg, Ubuntu 20.04): Debian 10.13
Apache or nginx version (eg, Apache 2.4.25): Irrelevant, php integrated web server
PHP version (eg, 7.4): 8.0

The issue you are facing:

Upon running

php8.0 -S localhost:8080

in the server folder of NextCloud server (branch stable28) i get the following after trying to access http://localhost:8080/ :

{"Exception":"Doctrine\\DBAL\\Exception","Message":"Failed to connect to the database: An exception occurred in the driver: could not find driver","Code":0,"Trace":[{"file":"\/home\/zehnder\/nextcloud19\/server\/3rdparty\/doctrine\/dbal\/src\/Connection.php","line":1654,"function":"connect","class":"OC\\DB\\Connection","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/3rdparty\/doctrine\/dbal\/src\/Connection.php","line":1081,"function":"getWrappedConnection","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/DB\/Connection.php","line":261,"function":"executeQuery","class":"Doctrine\\DBAL\\Connection","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/3rdparty\/doctrine\/dbal\/src\/Query\/QueryBuilder.php","line":341,"function":"executeQuery","class":"OC\\DB\\Connection","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/3rdparty\/doctrine\/dbal\/src\/Query\/QueryBuilder.php","line":377,"function":"executeQuery","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/DB\/QueryBuilder\/QueryBuilder.php","line":280,"function":"execute","class":"Doctrine\\DBAL\\Query\\QueryBuilder","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/AppConfig.php","line":421,"function":"execute","class":"OC\\DB\\QueryBuilder\\QueryBuilder","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/AppConfig.php","line":187,"function":"loadConfigValues","class":"OC\\AppConfig","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/AppConfig.php","line":377,"function":"getApps","class":"OC\\AppConfig","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/App\/AppManager.php","line":128,"function":"getValues","class":"OC\\AppConfig","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/App\/AppManager.php","line":149,"function":"getInstalledAppsValues","class":"OC\\App\\AppManager","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/legacy\/OC_App.php","line":231,"function":"getInstalledApps","class":"OC\\App\\AppManager","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/AppFramework\/Bootstrap\/Coordinator.php","line":90,"function":"getEnabledApps","class":"OC_App","type":"::"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/base.php","line":700,"function":"runInitialRegistration","class":"OC\\AppFramework\\Bootstrap\\Coordinator","type":"->"},{"file":"\/home\/zehnder\/nextcloud19\/server\/lib\/base.php","line":1200,"function":"init","class":"OC","type":"::"},{"file":"\/home\/zehnder\/nextcloud19\/server\/index.php","line":37,"args":["\/home\/zehnder\/nextcloud19\/server\/lib\/base.php"],"function":"require_once"}],"File":"\/home\/zehnder\/nextcloud19\/server\/lib\/private\/DB\/Connection.php","Line":139,"message":"Failed to connect to the database: An exception occurred in the driver: could not find driver","exception":{},"CustomMessage":"Failed to connect to the database: An exception occurred in the driver: could not find driver"}

I have installed php8.0-mysql and php8.0-pgsql, restarted my machine, tried again and got the same behaviour.

This did not happen with php7.4 and stable19.

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

Steps to replicate it:

  1. Pull NextCloud Server branch stable28
  2. Run php8.0 -S localhost:8080 in path/to/server/
  3. Access http://localhost:8080/ and see the error in the server logs

If there is any further information I can provide to solve the issue, I’d be happy to do so.

Thanks for any help.

It’s hard to understand what you did to get this error. as you state php74 and nc19 together with Debian 10 likely you performed an upgrade. in such situation it easy to miss some of required modules. please review you install and properly configured all required modules. Additionally php 8.0 is deprecated with nc28 you better move straight to php 8.2

1 Like

I should have specified: I am cloning NextCloud server from the github repository and developing an app. I am not “upgrading” per se, just trying my app on different versions for testing purpuses (I developed on nc19, have to test on nc28)

Your answer pointed me roughly in the right direction, the steps I took to solve this problem are the following:

  1. Delete the local NextCloud repository folder
  2. Clone the correct repository branch → git clone https://github.com/nextcloud/server.git --branch stable28
  3. Re-run git submodule update --init
  4. Purge and re-install php: sudo apt-get --purge remove php-common && sudo apt-get install php-common php-mysql php-cli
  5. run php -S localhost:8080 in the server folder and NextCloud will start succesfully without any server errors. Php version as of writing this post is 8.3.2

It seems that just switching branches breaks a lot of stuff in the background and it’s just better to remove the repository and re-clone it or work with git trees.

Onto a different problem now, thanks!

glad you solved the issue.

maybe this guide to setup development environment helps you

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.