I am just a home user of nextcloud but I’ve been unable to get any help on solving the “Failed to connect to database” problem below.
[/details]
Nextcloud version (eg, 20.0.5): 23.0.2
Operating system and version (eg, Ubuntu 20.04): Debian 11
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.52-1
PHP version (eg, 7.4): default is 8.1.1 (although I force php 8.0 and 7.4 when running commands) I have now changed my system default PHP to 8.0.14 with the same results
The issue you are facing:
Database not connecting. Any attempt to run occ command or cron.php results in
An unhandled exception has been thrown:
Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: could not find driver in /var/www/nextcloud/lib/private/DB/Connection.php:87
I have tried with various php versions all with the same problem
Is this the first time you’ve seen this error? (Y/N): Y
Steps to replicate it:
- run any occ command
- try to manuall run cron.php
The output of your Nextcloud log in Admin > Logging:
OCP\AppFramework\Db\DoesNotExistException: FileInfo not found
/var/www/nextcloud/apps/duplicatefinder/lib/Service/FileInfoService.php - line 88:
OCA\DuplicateFinder\Db\FileInfoMapper->find()
/var/www/nextcloud/apps/duplicatefinder/lib/Listener/FilesytemListener.php - line 54:
OCA\DuplicateFinder\Service\FileInfoService->find()
/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php - line 87:
OCA\DuplicateFinder\Listener\FilesytemListener->handle()
/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php - line 251:
OC\EventDispatcher\ServiceEventListener->__invoke()
/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php - line 73:
Symfony\Component\EventDispatcher\EventDispatcher->callListeners()
/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php - line 88:
Symfony\Component\EventDispatcher\EventDispatcher->dispatch()
/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php - line 100:
OC\EventDispatcher\EventDispatcher->dispatch()
/var/www/nextcloud/lib/private/Files/Node/HookConnector.php - line 194:
OC\EventDispatcher\EventDispatcher->dispatchTyped()
/var/www/nextcloud/lib/private/legacy/OC_Hook.php - line 106:
OC\Files\Node\HookConnector->postRename()
/var/www/nextcloud/lib/private/Files/View.php - line 861:
OC_Hook::emit()
/var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php - line 442:
OC\Files\View->rename()
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Tree.php - line 160:
OCA\DAV\Connector\Sabre\Directory->moveInto()
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php - line 612:
Sabre\DAV\Tree->move()
/var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php - line 89:
Sabre\DAV\CorePlugin->httpMove()
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 472:
Sabre\DAV\Server->emit()
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 253:
Sabre\DAV\Server->invokeMethod()
/var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php - line 321:
Sabre\DAV\Server->start()
/var/www/nextcloud/apps/dav/lib/Server.php - line 339:
Sabre\DAV\Server->exec()
/var/www/nextcloud/apps/dav/appinfo/v2/remote.php - line 35:
OCA\DAV\Server->exec()
/var/www/nextcloud/remote.php - line 166:
require_once("/var/www/ne ... p")
The output of your config.php file in /path/to/nextcloud
(make sure you remove any identifiable information!):
<?php
$CONFIG = array (
'instanceid' => '',
'passwordsalt' => '',
'secret' => '',
'trusted_domains' =>
array (
0 => 'cloud.xxxxxx.com',
1 => '192.168.1.23',
),
'datadirectory' => '/var/www/nextcloud/data',
'dbtype' => 'mysql',
'version' => '23.0.2.1',
'overwrite.cli.url' => 'https://cloud.xxxxxx.com',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'mysql.utf8mb4' => true,
'dbuser' => 'nextcloud',
'dbpassword' => 'xxxxxxx',
'installed' => true,
'memcache.local' => '\\OC\\Memcache\\APCu',
'updater.secret' => '',
'mail_domain' => 'xxxxxxx.com',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_from_address' => 'admin',
'mail_smtphost' => '127.0.0.1',
'maintenance' => false,
'theme' => '',
'loglevel' => 2,
'default_phone_region' => 'US',
);
The output of your Apache/nginx/system log in /var/log/____
:
[Tue Mar 01 00:00:02.982984 2022] [mpm_prefork:notice] [pid 874] AH00163: Apache/2.4.52 (Debian) mpm-itk/2.4.7-04 OpenSSL/1.1.1k configured -- resuming normal operations
[Tue Mar 01 00:00:02.983008 2022] [core:notice] [pid 874] AH00094: Command line: '/usr/sbin/apache2'
[Tue Mar 01 10:21:58.597338 2022] [access_compat:error] [pid 665862] [client 75.146.113.101:37856] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata
[Tue Mar 01 10:58:08.084845 2022] [access_compat:error] [pid 666581] [client 75.146.113.101:38248] AH01797: client denied by server configuration: /var/www/nextcloud/data/.ocdata