[SOLVED] How to recover: "PDOException: could not find driver in /srv/nextcloud/html/3rdparty/doctrine/dbal/src/Driver/PDO/PDOConnect.php:28"

The Basics

  • Nextcloud Server version: 33.0.8
  • Operating system and version: Debian 13.6
  • Web server and version: apache2/2.4.68-1~deb13u1
  • Reverse proxy and version: none
  • PHP version: 8.4
  • Is this the first time you’ve seen this error?: Yes
  • When did this problem seem to first start?
    • When attempting to 'maintenance:repair'
  • Installation method (e.g. AlO, NCP, Bare Metal/Archive, etc.)
  • Are you using CloudfIare, mod_security, or similar?: No

Summary of the issue you are facing:

During an attempted upgrade, I mistakenly removed the entire Nextcloud …/html/ directory. Realising this was a problem I attempted to recover:

  • Ensure the Nextcloud database is not damaged.
  • Ensure the Nextcloud …/data/ directory is not damaged.
  • Restore the Nextcloud …/html/config/ directory.
  • Download the Nextcloud installation archive from https://download.nextcloud.com/server/releases/nextcloud-33.0.8.zip
    • Unpack that installation archive to …/html/.
  • Run … occ maintenance:repair command to correct this broken Nextcloud instance.

Nextcloud crashes, complaining (accurately) that a file it wants is not in …/html/3rdparty/.

How can I continue the repair beyond this point; how do I provide Nextcloud the correct contents of …/html/3rdparty/? It does not appear in the installation archive, nor in any backup I have.

I assume there might be many more files Nextcloud expects to find in that directory. How can I get the repair complete without those files; alternatively, how can I find and install those files correctly?

Steps to replicate it (hint: details matter!):

  1. Make the mistake of deleting everything within …/html/.

  2. Restore the …/html/config/ directory.

  3. Download and install Nextcloud installation archive nextcloud-33.0.8.zip into …/html/.

  4. Run Nextcloud admin command … occ maintenance:repair.

Nextcloud crashes with a traceback:

An unhandled exception has been thrown:
PDOException: could not find driver in /srv/nextcloud/html/3rdparty/doctrine/dbal/src/Driver/PDO/PDOConnect.php:28
Stack trace:
…

Configuration

Nextcloud

<?php

$CONFIG = array(
    'instanceid' => 'REDACTED',
    'passwordsalt' => 'REDACTED',
    'secret' => 'REDACTED',
    'config_is_read_only' => false,
    'installed' => true,
    'log_type' => 'syslog',
    'logdateformat' => DateTime::ISO8601,
    'maintenance' => false,
    'maintenance_window_start' => 23,
    'trusted_domains' => [
        'REDACTED.example.org',
    ],
    'overwrite.cli.url' => 'https://REDACTED.example.org/nextcloud',
    'htaccess.RewriteBase' => '/nextcloud',
    'mail_from_address' => 'nextcloud',
    'mail_domain' => 'REDACTED.example.org',
    'mail_send_plaintext_only' => true,
    'default_language' => 'en',
    'default_locale' => 'en_AU',
    'default_phone_region' => 'AU',
    'trashbin_retention_obligation' => 'auto, 30',
    'memcache.locking' => '\\OC\\Memcache\\Redis',
    'redis' => array(
        'host' => 'localhost',
        'port' => 6379,
        'timeout' => 0.0,
        'password' => '',
    ),
);
?>

That’s the official source repo snapshot, but not an installation asset. For example, it lacks 3rdparty/ and other core components located in other repositories, that are required for an actual installation.

Please use the official Archive download links.

When did that change? I’ve been installing from those archives for years without a problem.

Looking in the installation page today, it leads me to a file in the same directory, but with no Nextcloud version (‘latest.zip’). This is not suitable for a reliable automated install, I need to download the file for the specific version I’ve chosen, for a reproducible deployment. So which file should I be using for that?

The only archive files there that are marked by full version number (e.g. “33.0.8”), are the files named starting with ‘nextcloud’ (e.g. https://download.nextcloud.com/server/releases/nextcloud-33.0.8.zip for version “33.0.8”). If you say I should not be using those, which file with a fully-specified version URL are you saying I should install?

Also this does not seem to do much to address the problem I face immediately: How do I get the ‘3rdparty’ directory populated correctly, for some specific Nextcloud version?

Attempting to proceed:

  • Downloaded ‘latest-33.zip’ and unpacked it to a temporary directory.
  • Replaced (removed existing, copied from the unpacked files) the ‘3rdparty/’ directory.

When I run …/occ maintenance:repair I get the same crash and error as initially reported.

How do I determine what files are needed, and how to install precisely those files to satisfy this Nextcloud instance to the point it can repair?

My bad. I completely misread the URL; I thought you were pulling it from the GitHub link. I blame my mobile device I was reading your message on yesterday. :slight_smile: Sorry about that.

The full stack trace would be more helpful, but this isn’t say a file is missing from 3rdparty. It’s saying the PHP extension for your database isn’t installed.

I don’t see any database configuration in your provided config file.

Thank you for this. It prompted me to verify the restored configuration, and indeed the database connection settings were not there.

I now have the database settings in one place, where the ‘autoconfig.php’ and ‘config.php’ can both use them. With this in place, the error ceases and I can continue.