Upgraded php from 8.0.30 to 8.3 and broke everything

I have been using Nextcloud for years. I upgraded from 26 to 27 to 28. After seeing all of the warning messages I began to tackle them. The first was that I needed to upgrade from php 8.0 to 8.1 or higher. I tried to do just that. The error I get now is below.

`Internal Server Error

The server encountered an internal error and was unable to complete your request.
Please contact the server administrator if this error reappears multiple times, please include the technical details below in your report.
More details can be found in the server log.`

My apache access.log output is below.

192.168.2.1 - admin [07/Jan/2024:21:12:41 +0000] "GET /status.php HTTP/1.1" 500 719 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.22 - - [07/Jan/2024:21:13:33 +0000] "GET /ocs/v2.php/apps/notifications/api/v2/notifications HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0"
192.168.2.1 - admin [07/Jan/2024:21:13:44 +0000] "GET /status.php HTTP/1.1" 500 3893 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.22 - - [07/Jan/2024:21:13:57 +0000] "PUT /ocs/v2.php/apps/user_status/api/v1/heartbeat?format=json HTTP/1.1" 500 185 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0"
192.168.2.1 - admin [07/Jan/2024:21:14:45 +0000] "GET /status.php HTTP/1.1" 500 719 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.21 - - [07/Jan/2024:21:14:56 +0000] "GET /index.php HTTP/1.1" 500 477 "http://192.168.2.10/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0"
192.168.1.21 - - [07/Jan/2024:21:14:58 +0000] "GET /index.php HTTP/1.1" 500 477 "http://192.168.2.10/" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:121.0) Gecko/20100101 Firefox/121.0"
192.168.2.1 - admin [07/Jan/2024:21:15:47 +0000] "GET /status.php HTTP/1.1" 500 719 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.2.1 - admin [07/Jan/2024:21:16:49 +0000] "GET /status.php HTTP/1.1" 500 719 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"
192.168.1.22 - - [07/Jan/2024:21:16:52 +0000] "GET /index.php/csrftoken HTTP/1.1" 500 477 "-" "Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/119.0"
192.168.2.1 - admin [07/Jan/2024:21:17:51 +0000] "GET /status.php HTTP/1.1" 500 719 "-" "Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)"

I do not know where my nextcloud log file is located. The list of my nextcloud folder is below.

nextcloud folder list

<?php
$CONFIG = array (
  'instanceid' => x
  'passwordsalt' => x
  'secret' => x
  'trusted_domains' =>
  array (
    0 => 'x
  ),
  'datadirectory' => '/mnt/NextCloud',
  'dbtype' => 'mysql',
  'version' => '28.0.1.1',
  'overwrite.cli.url' => x
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'dbuser' => 'nextcloud',
  'dbpassword' => x
  'installed' => true,
  'maintenance' => true,
  'loglevel' => 2,
  'updater.release.channel' => 'stable',
  'mysql.utf8mb4' => true,
  'mail_from_address' => x
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => x
  'mail_smtphost' => x
  'mail_smtpport' => '587',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => x
  'mail_smtppassword' => x
  'mail_smtpsecure' => 'tls',
  'theme' => '',
);

Nextcloud version - 28.0.1
Ubuntu 20.04
Apache 2.4.41
PHP 8.3 (upgraded from 8.0)

Hi,
Please try:

sudo -u www-data php /var/www/nextcloud/occ log:file

this might give a location.
Or with:

sudo -u www-data php /var/www/nextcloud/occ log:watch

you should follow your logs.

Thanks for the reply. This is the output I get from both of those commands. When I originally installed nextcloud, which was quite a while ago, I messed up and installed it in /var/www/html.

bigdaddy@ubuntulamp:/var/www/html$ sudo -u www-data php /var/www/html/occ log:file
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/html/lib/private/DB/Connection.php:139
Stack trace:
#0 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1654): OC\DB\Connection->connect()
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1081): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/html/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(337): OC\DB\Connection->executeQuery()
#4 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(377): Doctrine\DBAL\Query\QueryBuilder->executeQuery()
#5 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/html/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/html/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#8 /var/www/html/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#9 /var/www/html/lib/private/App/AppManager.php(128): OC\AppConfig->getValues()
#10 /var/www/html/lib/private/App/AppManager.php(149): OC\App\AppManager->getInstalledAppsValues()
#11 /var/www/html/lib/private/legacy/OC_App.php(231): OC\App\AppManager->getInstalledApps()
#12 /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#13 /var/www/html/lib/base.php(700): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#14 /var/www/html/lib/base.php(1200): OC::init()
#15 /var/www/html/console.php(48): require_once('...')
#16 /var/www/html/occ(11): require_once('...')
#17 {main}bigdaddy@ubuntulamp:/var/www/html$
bigdaddy@ubuntulamp:/var/www/html$
bigdaddy@ubuntulamp:/var/www/html$ sudo -u www-data php /var/www/html/occ log:watch
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/html/lib/private/DB/Connection.php:139
Stack trace:
#0 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1654): OC\DB\Connection->connect()
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1081): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/html/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(337): OC\DB\Connection->executeQuery()
#4 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(377): Doctrine\DBAL\Query\QueryBuilder->executeQuery()
#5 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/html/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/html/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#8 /var/www/html/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#9 /var/www/html/lib/private/App/AppManager.php(128): OC\AppConfig->getValues()
#10 /var/www/html/lib/private/App/AppManager.php(149): OC\App\AppManager->getInstalledAppsValues()
#11 /var/www/html/lib/private/legacy/OC_App.php(231): OC\App\AppManager->getInstalledApps()
#12 /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#13 /var/www/html/lib/base.php(700): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#14 /var/www/html/lib/base.php(1200): OC::init()
#15 /var/www/html/console.php(48): require_once('...')
#16 /var/www/html/occ(11): require_once('...')
#17 {main}bigdaddy@ubuntulamp:/var/www/html$

Ok thanks.

a. Please Restart your database in case it is running and try again.
b. Or fix your database in case it is not running.

:slight_smile:

It looks like things are fine?

bigdaddy@ubuntulamp:/var/www/html/config$ sudo systemctl status mysql
● mariadb.service - MariaDB 10.3.38 database server
     Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
     Active: active (running) since Sun 2024-01-07 22:35:46 UTC; 18min ago
       Docs: man:mysqld(8)
             https://mariadb.com/kb/en/library/systemd/
    Process: 780 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
    Process: 855 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 863 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= ||   VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`; [ $? -eq 0 ]   && systemctl set-environment _WSREP_START_POSITION=$VAR || >
    Process: 1059 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
    Process: 1061 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
   Main PID: 935 (mysqld)
     Status: "Taking your SQL requests now..."
      Tasks: 31 (limit: 9397)
     Memory: 147.1M
     CGroup: /system.slice/mariadb.service
             └─935 /usr/sbin/mysqld

Jan 07 22:35:46 ubuntulamp systemd[1]: Started MariaDB 10.3.38 database server.
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1063]: Upgrading MySQL tables if necessary.
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1066]: /usr/bin/mysql_upgrade: the '--basedir' option is always ignored
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1066]: Looking for 'mysql' as: /usr/bin/mysql
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1066]: Looking for 'mysqlcheck' as: /usr/bin/mysqlcheck
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1066]: This installation of MariaDB is already upgraded to 10.3.38-MariaDB.
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1066]: There is no need to run mysql_upgrade again for 10.3.38-MariaDB.
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1066]: You can use --force if you still want to run mysql_upgrade
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1079]: Checking for insecure root accounts.
Jan 07 22:35:46 ubuntulamp /etc/mysql/debian-start[1083]: Triggering myisam-recover for all MyISAM tables and aria-recover for all Aria tables

…Please Restart your database in case it is running and try again :wink:

The database is running and I was able to log in to it from the command line. I used the same login information in the config.php file.

Please restart the database and try the occ command again.
I might be that the data base started ahead of your nextcloud-config and after restarting occ can connect to the database again. I had this before. Sorry for not telling you.

Ah, ok, I see. I restarted the server. I also added a line for a log file in the config file. No change.
I added this line to the config.php but it seems to have no effect. The log file is empty, I created it with touch and made permissions www-data.

‘log_file’ => ‘/var/www/html/data/nextcloud.log’,

bigdaddy@ubuntulamp:/var/www/html/data$ sudo -u www-data php /var/www/nextcloud/occ log:file
Could not open input file: /var/www/nextcloud/occ
bigdaddy@ubuntulamp:/var/www/html/data$ sudo -u www-data php /var/www/html/occ log:file
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/html/lib/private/DB/Connection.php:139
Stack trace:
#0 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1654): OC\DB\Connection->connect()
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1081): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/html/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(337): OC\DB\Connection->executeQuery()
#4 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(377): Doctrine\DBAL\Query\QueryBuilder->executeQuery()
#5 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/html/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/html/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#8 /var/www/html/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#9 /var/www/html/lib/private/App/AppManager.php(128): OC\AppConfig->getValues()
#10 /var/www/html/lib/private/App/AppManager.php(149): OC\App\AppManager->getInstalledAppsValues()
#11 /var/www/html/lib/private/legacy/OC_App.php(231): OC\App\AppManager->getInstalledApps()
#12 /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#13 /var/www/html/lib/base.php(700): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#14 /var/www/html/lib/base.php(1200): OC::init()
#15 /var/www/html/console.php(48): require_once('...')
#16 /var/www/html/occ(11): require_once('...')
#17 {main}bigdaddy@ubuntulamp:/var/www/html/data$ sudo -u www-data php /var/www/html/occ log:watch
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/html/lib/private/DB/Connection.php:139
Stack trace:
#0 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1654): OC\DB\Connection->connect()
#1 /var/www/html/3rdparty/doctrine/dbal/src/Connection.php(1081): Doctrine\DBAL\Connection->getWrappedConnection()
#2 /var/www/html/lib/private/DB/Connection.php(261): Doctrine\DBAL\Connection->executeQuery()
#3 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(337): OC\DB\Connection->executeQuery()
#4 /var/www/html/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(377): Doctrine\DBAL\Query\QueryBuilder->executeQuery()
#5 /var/www/html/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/html/lib/private/AppConfig.php(418): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/html/lib/private/AppConfig.php(184): OC\AppConfig->loadConfigValues()
#8 /var/www/html/lib/private/AppConfig.php(374): OC\AppConfig->getApps()
#9 /var/www/html/lib/private/App/AppManager.php(128): OC\AppConfig->getValues()
#10 /var/www/html/lib/private/App/AppManager.php(149): OC\App\AppManager->getInstalledAppsValues()
#11 /var/www/html/lib/private/legacy/OC_App.php(231): OC\App\AppManager->getInstalledApps()
#12 /var/www/html/lib/private/AppFramework/Bootstrap/Coordinator.php(90): OC_App::getEnabledApps()
#13 /var/www/html/lib/base.php(700): OC\AppFramework\Bootstrap\Coordinator->runInitialRegistration()
#14 /var/www/html/lib/base.php(1200): OC::init()
#15 /var/www/html/console.php(48): require_once('...')
#16 /var/www/html/occ(11): require_once('...')
#17 {main}bigdaddy@ubuntulamp:/var/www/html/data$
  1. Depending on the system first step I would check what the following command shows me.
apt-get -s install  apache2 mariadb-server libapache2-mod-php php-gd php-mysql \
php-curl php-mbstring php-intl php-gmp php-bcmath php-xml php-imagick php-zip

apt-get -s

Is a try-run-

To make sure all the modules are installed.

If not:
apt-get install php-missing-module
and try if occ now is working.

The logfile etc afterwards as occ is our friend :slight_smile:

Is the rest of the system actual?

I got it to work. I am not entirely sure how, but I had a mix up between php 8.1 and 8.3 somewhere. I think apache thought the version was 8.3 but it was really 8.1. The error messages about not logging in to the database are misleading I think. I ended up having to install php8.1-apcu. Once that was installed things worked. Thanks SO MUCH for your help. Much appreciated.