Nextcloud 25 failing on PHP 8.2

$ sudo -u www-data php8.1 nextcloud/occ --help
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/nextcloud/lib/private/DB/Connection.php:139

$ sudo -u www-data php8.2 nextcloud/occ --help
This version of Nextcloud is not compatible with PHP>=8.2.
You are currently running 8.2.1
$ php -v
PHP 8.2.1 (cli) (built: Jan 7 2023 08:34:34) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.1, Copyright (c) Zend Technologies
with Zend OPcache v8.2.1, Copyright (c), by Zend Technologies
$ @ update-alternatives --display php
php - manual mode
link best version is /usr/bin/php8.2
link currently points to /usr/bin/php8.2
link php is /usr/bin/php
slave php.1.gz is /usr/share/man/man1/php.1.gz
/usr/bin/php8.1 - priority 81
slave php.1.gz: /usr/share/man/man1/php8.1.1.gz
/usr/bin/php8.2 - priority 82
slave php.1.gz: /usr/share/man/man1/php8.2.1.gz

On my Nextcloud web page I get the following message:

This version of Nextcloud is not compatible with PHP>=8.2.
You are currently running 8.2.1.

I’ve also tried setting the default version of php to 8.1 and restarting Apache but the home page still reports the above message.

I have updated to the latest Beta version, but I can’t show it here as nothing works in querying my installation since all php commands fail.

1 Like

You must differ between PHP cli and PHP apache2 modules. Do you use apache2?

Check with
dpkg -l|grep php
and remove all php8.2 and install php8.1.

Maybe you must reactivate php in apache2.
a2enmod php8.1

@devnull - thanks for the tips. I checked and found many packages for php8.1 had been removed, including libapache2-mod-php8.1, which is why I couldn’t enable it in Apache2. I re-installed all missing 8.1 packages and now all works again.

I’m guessing one of the packages that I’ve updated on my server also updated php to 8.2.1. I’ll keep an eye out for this in the future.

/lib/versioncheck.php edit and remove this:

// Show warning if >= PHP 8.2 is used as Nextcloud is not compatible with >= PHP 8.2 for now
if (PHP_VERSION_ID >= 80200) {
echo ‘This version of Nextcloud is not compatible with PHP>=8.2.
echo 'You are currently running ’ . PHP_VERSION . ‘.’;

Don’t you think, there might be reasons why they are still blocking PHP8.2? If you want to this on your own instance, fine, but that’s not a proper solution to the issue at hand.

I quite agree, but as a possible solution to this problem, so as not to break some systems, the option is not bad. this does not break nextcloud, but it is a fairly simple and reliable solution to the problem, even for the future.

Is there a user-friendly, step by step guide for someone who is not a coder on how to implement this solution? (I don’t know where I need to remove what, and how to reinstall what where). I cannot access webGUI since I get the same error message as original post stated.

I tried executing on command line:
dpkg -l|grep php

And I got error message saying:
dpkg: not found

1 Like

@oy2n It completely depends on what OS you’re running NC on and what install method you’re using.

This issue really shouldn’t arise unless one has been doing some weird stuff and inadvertently created this situation.

If dpkg is not found it just means you’re not using Ubuntu or Debian. You’ll need to share the basics of your environment since the process and commands will be different.

@jtr I’m using UNRAID OS. I’m not sure what is meant by “what install method you’re using”. I have not been doing any “weird stuff”. The issue occurred when Nextcloud auto-updated few days ago. Since then, I’ve been having this issue. How do i provide this: "You’ll need to share the basics of your environment "?

I tried following [BUG] This version of Nextcloud is not compatible with > PHP · Issue #288 · linuxserver/docker-nextcloud · GitHub
to resolve the issue.

It did not help

UPDATE: And now i know WHY it didn’t work. You should add guidance to state (and SHOW!!) that (and how) MAINTENANCE MODE must be turned OFF.

This is a prompt when updating via CLI,…and I chose “Y”…so my maintenance mode was on.

Guys,…you cannot ASSUME what the user will do! You must state what the user MUST do at each single step, and at the most GRANULAR level, no matter how irrelevant it may appear to “smart” heads. Ok?


1 Like

That is a very important information, without that knowledge, it is as good as impossible to help you.
So If you’re expecting help, don’t be stingy with information about your system and your setup.

Since UNRAID is based on slackware linux,
dpkg -l | grep php
corresponds to
pkginfo | grep -i php

and since running Nextcloud on UNRAID is mostly in docker container, that would be - if I am right - the install method.

But no matter how we twist and turn the tide, there’s no getting around the fact that you need to acquire certain basic technical skills. Even if you’ve paid for your UNRAID Stick, that doesn’t mean it’s all being shoved bit by bit into your mouth.

Based in the info you provided elsewhere, you’re using a third party Nextcloud Docker image from You’ll have to take that up with them:

They appear to explain how to reach out to them if you run into issues in that linked thread.

They also have their own forum, which you might also find a good resource (although it is not Nextcloud specific):

Among other reasons, this is why we asked about your installation details. :slight_smile:

In any case, I’m glad you got it working! :+1: