Nextcloud 21.0.4 crashes with PHP 8.0

Hi there,

I’ve updated my server to use PHP 8.0. We’re on Ubuntu 18.04.6 LTS, with nginx 1.18.0, Postgres 10.18, and using Nextcloud 21.0.4.

When swtiching the nginx conf to use /run/php/php8.0-fpm.sock, Nextcloud crashes.

$ sudo -u www-data php /var/www/nextcloud/occ
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:85
Stack trace:
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1486): OC\DB\Connection->connect()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1014): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/nextcloud/lib/private/DB/Connection.php(226): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(210): OC\DB\Connection->executeQuery()
#4 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\DBAL\Query\QueryBuilder->execute()
#5 /var/www/nextcloud/lib/private/AppConfig.php(345): OC\DB\QueryBuilder\QueryBuilder->execute()
#6 /var/www/nextcloud/lib/private/AppConfig.php(110): OC\AppConfig->loadConfigValues()
#7 /var/www/nextcloud/lib/private/AppConfig.php(301): OC\AppConfig->getApps()
#8 /var/www/nextcloud/lib/private/legacy/OC_App.php(965): OC\AppConfig->getValues()
#9 /var/www/nextcloud/lib/private/Server.php(682): OC_App::getAppVersions()
#10 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}()
#11 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#12 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#13 /var/www/nextcloud/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query()
#14 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#15 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(177): OC\AppFramework\Utility\SimpleContainer->get()
#16 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#17 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(114): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#18 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#19 /var/www/nextcloud/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query()
#20 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#21 /var/www/nextcloud/lib/private/Server.php(1031): OC\AppFramework\Utility\SimpleContainer->get()
#22 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}()
#23 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#24 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#25 /var/www/nextcloud/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query()
#26 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#27 /var/www/nextcloud/lib/private/Server.php(1990): OC\AppFramework\Utility\SimpleContainer->get()
#28 /var/www/nextcloud/lib/private/Files/View.php(119): OC\Server->getLockingProvider()
#29 /var/www/nextcloud/lib/private/Server.php(430): OC\Files\View->__construct()
#30 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(155): OC\Server->OC\{closure}()
#31 /var/www/nextcloud/3rdparty/pimple/pimple/src/Pimple/Container.php(118): OC\AppFramework\Utility\SimpleContainer->OC\AppFramework\Utility\{closure}()
#32 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(122): Pimple\Container->offsetGet()
#33 /var/www/nextcloud/lib/private/ServerContainer.php(137): OC\AppFramework\Utility\SimpleContainer->query()
#34 /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php(56): OC\ServerContainer->query()
#35 /var/www/nextcloud/lib/private/Server.php(1353): OC\AppFramework\Utility\SimpleContainer->get()
#36 /var/www/nextcloud/lib/base.php(588): OC\Server->boot()
#37 /var/www/nextcloud/lib/base.php(1076): OC::init()
#38 /var/www/nextcloud/console.php(49): require_once('...')
#39 /var/www/nextcloud/occ(11): require_once('...')
#40 {main}

Nextcloud config is:

<?php
$CONFIG = array (
  'passwordsalt' => '***SENSITIVE-REMOVED***',
  'secret' => '***SENSITIVE-REMOVED***',
  'trusted_domains' =>
  array (
    0 => '***SENSITIVE-REMOVED***'
  ),
  'datadirectory' => '/mnt/nextcloud-data',
  'tempdirectory' => '/mnt/nextcloud-data/***SENSITIVE-REMOVED***',
  'skeletondirectory' => '/mnt/nextcloud-data/***SENSITIVE-REMOVED***',
  'templatedirectory' => '/mnt/nextcloud-data/***SENSITIVE-REMOVED***',
  'dbtype' => 'pgsql',
  'version' => '21.0.4.1',
  'overwrite.cli.url' => '***SENSITIVE-REMOVED***',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '***SENSITIVE-REMOVED***',
  'dbpassword' => '***SENSITIVE-REMOVED***',
  'installed' => true,
  'instanceid' => '***SENSITIVE-REMOVED***',
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'loglevel' => 2,
  'logtimezone' => 'Australia/Melbourne',
  'mail_smtpmode' => 'smtp',
  'remember_login_cookie_lifetime' => 0,
  'log_rotate_size' => '10485760',
  'trashbin_retention_obligation' => 'auto, 14',
  'versions_retention_obligation' => 'auto, 365',
  'simpleSignUpLink.shown' => false,
  'login_form_autocomplete' => true,
  'filelocking.enabled' => true,
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => 'localhost',
    'port' => '6379',
    'dbindex' => '0',
    'timeout' => '1.5',
  ),
  'maintenance' => false,
  'default_phone_region' => 'AU',
  'default_locale' => 'en_AU',
  'force_locale' => 'en_AU',
  'default_language' => 'en',
  'force_language' => 'en',
  'defaultapp' => 'activity,files',
  'activity_expire_days' => 180,
  'session_lifetime' => 14400,
  'session_keepalive' => false,
  'auth.webauthn.enabled' => false,
  'overwriteprotocol' => 'https',
  'app_install_overwrite' =>
  array (
    0 => 'activitylog',
    1 => 'files_readmemd',
  ),
  'updater.release.channel' => 'stable',
  'theme' => '',
  'connectivity_check_domains' =>
  array (
    0 => 'nextcloud.com'
  ),
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'notifications',
  'mail_domain' => '***SENSITIVE-REMOVED***',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '***SENSITIVE-REMOVED***',
  'mail_smtpport' => '465',
  'mail_smtpname' => '***SENSITIVE-REMOVED***',
  'mail_smtppassword' => '***SENSITIVE-REMOVED***',
);

Active Apps:

 Accessibility
1.7.0

Activities for shared file downloads
1.11.1
Activity
2.14.3
Announcement center
5.0.0
AppOrder
0.13.0
Auditing / Logging
1.11.0
Brute-force settings
2.2.0
Calendar
2.3.3
Camera RAW Previews
0.7.12
Collaborative tags
1.11.0
Comments
1.11.0
Deck
1.4.4
Deleted files
1.11.0
Draw.io
1.0.1
External sites
3.8.2
Extract
1.3.2
File sharing
1.13.1
First run wizard
2.10.0
Forms
2.3.0
Group folders
9.0.3
Impersonate
1.8.0
Link editor
1.1.6
Log Reader
2.6.0
Metadata
0.14.0
Monitoring
1.11.0
Notes
4.1.1
Notifications
2.9.0
Notifications for calendar event updates
1.3.0
ONLYOFFICE
7.1.2
Password policy
1.11.0
Passwords
2021.9.20
PDF viewer
2.1.0
Photos
1.3.0
Pico CMS
1.0.16
Plain text editor
2.14.0
Preview Generator
3.1.1
Privacy
1.5.0
Quota warning
1.11.0
Ransomware protection
1.11.0
README.md
1.2.0
Recommendations
1.0.0
Right click
1.0.0
Share by mail
1.11.0
Tasks
0.14.2
Text
3.2.0
Theming
1.12.0
Update notification
1.11.0
Versions
1.14.0
Video player
1.10.0
Whiteboard integration
0.0.14

Nextcloud log:

{"reqId":"YKyDNB0cknpjqqtQp7ld","level":3,"time":"2021-09-14T05:59:43+10:00","remoteAddr":"***IP-REMOVED***","user":"--","app":"PHP","method":"GET","url":"/apps/theming/favicon?v=50","message":{"Exception":"Error","Message":"fopen(/mnt/nextcloud-data/data_dir_writability_test_613fadaf9045b.tmp): failed to open stream: Permission denied at /var/www/nextcloud/lib/private/legacy/OC_Util.php#809","Code":0,"Trace":[{"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::"},{"file":"/var/www/nextcloud/lib/private/legacy/OC_Util.php","line":809,"function":"fopen"},{"file":"/var/www/nextcloud/lib/base.php","line":650,"function":"checkServer","class":"OC_Util","type":"::"},{"file":"/var/www/nextcloud/lib/base.php","line":1076,"function":"init","class":"OC","type":"::"},{"file":"/var/www/nextcloud/index.php","line":35,"args":["/var/www/nextcloud/lib/base.php"],"function":"require_once"}],"File":"/var/www/nextcloud/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:92.0) Gecko/20100101 Firefox/92.0","version":"21.0.4.1","id":"6140404c04aca"}

Is this a bug or a config problem?

A follow up on this one. This occurs even when all apps are disabled.

I’m guessing this line means something is wrong with the core handling Postgres?

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:85