My server hosts Nextcloud version 188.8.131.52 and has been upgraded to Ubuntu 20.04.3 LTS. In the course of this update, PHP 7.4 got replaced by PHP 8.0. After this, Nextcloud access to the database (MariaDB 10.3.31) was broken. We run Apache2 so that I accessed the Apache2 error log to identify a reason for this effect:
AH01071: Got error ‘PHP message: PHP Fatal error: Uncaught Doctrine\DBAL\Exception: Failed to connect to the database: An exception occurred in the driver: SQLSTATE[HY000]  MySQL server has gone away in /var/www/html/nextcloud/lib/private/DB/Connection.php:85\nStack trace:\n#0
/var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1486): OC\DB\Connection->connect()\n#1 /var/www/html/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1014): Doctrine\DBAL\Connection->getWrappedConnection()\n#2
Nextcloud version (eg, 20.0.5):
Operating system and version (eg, Ubuntu 20.04):
Ubuntu 20.04.3 LTS
Apache or nginx version (eg, Apache 2.4.25):
PHP version (eg, 7.4):
Is this the first time you’ve seen this error? (Y/N): Y
The output of your Nextcloud log in Admin > Logging:
The error is such severe that only the Apache error log, but not the Nextcloud log is further populated.
Worth to note, when I connect to the Nextcloud database via phpMyAdmin that is installed at the same server, I can access the Nextcloud database.
I have already purged the entire php stuff and re-installed php8.0* packages and re-activated the php8.0-fpm module at Apache2. No change. I can still access the Nextcloud database via phpMyAdmin, but not via the Nextcloud code.