Upgrade fails due to "wrong PHP version" (this is not true)

Nextcloud version (eg, 18.0.2): 13.0.2 → 14.0.14
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4
PHP version (eg, 7.1): multiple, selected 7.2

The issue you are facing:
I ran the command line upgrad and this happened:

php7.2 /var/www/xxx/cloud/updater/updater.phar
Nextcloud Updater - version: v13.0.0beta1

Current version is 13.0.2.

Update to Nextcloud 14.0.14 available. (channel: "stable")
Following file will be downloaded automatically: https://download.nextcloud.com/server/releases/nextcloud-14.0.14.zip

Steps that will be executed:
[ ] Check for expected files
[ ] Check for write permissions
[ ] Enable maintenance mode
[ ] Create backup
[ ] Downloading
[ ] Verify integrity
[ ] Extracting
[ ] Replace entry points
[ ] Delete old files
[ ] Move new files in place
[ ] Done

Start update? [y/N] y

Info: Pressing Ctrl-C will finish the currently running step and then stops the updater.

[✔] Check for expected files
[✔] Check for write permissions
[✔] Enable maintenance mode
[✔] Create backup
[✔] Downloading
[✔] Verify integrity
[✔] Extracting
[✔] Replace entry points
[✔] Delete old files
[✔] Move new files in place
[✔] Done

Update of code successful.

Should the "occ upgrade" command be executed? [Y/n]
This version of Nextcloud is not compatible with > PHP 7.3.<br/>You are currently running 7.4.13.
Keep maintenance mode active? [y/N]

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it: See terminal output above

The output of your Nextcloud log in Admin > Logging:

Internal Server Error

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'passwordsalt' => '***',
  'secret' => '***',
  'trusted_domains' =>
  array (
    0 => '***',
  ),
  'datadirectory' => '/var/www/xxx/cloud_data',
  'overwrite.cli.url' => 'https://***/',
  'htaccess.RewriteBase' => '/',
  'dbtype' => 'pgsql',
  'version' => '13.0.2.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '***',
  'dbpassword' => '***',
  'installed' => true,
  'instanceid' => '***',
  'mail_domain' => '***',
  'mail_smtpmode' => 'php',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'noreply',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => true,
  'theme' => '',
  'loglevel' => 2,
);

The output of your Apache/nginx/system log in /var/log/____:

not used

Additional information:
I understand that Nextcloud only supports a very limited range of PHP versions. I only had access to PHP 7.0 until the recent server upgrade. Now I can select the version to use. I’ve currently selected 7.2 for that virtual host and everything worked fine. Now I’m trying to upgrade Nextcloud to a current version. For the upgrade, I selected php7.2 (see terminal output above). The first step seems to work but then it breaks halfway with a wrong error message. I’m running PHP 7.2, not 7.4.

So, what is the current state of my installation (aside from being unusable) and what should I do to complete it now?

If this upgrade is lost, what is the suggested procedure to reinstall a current version and restore all previous data? (I have a backup of the nextcloud and data directories as well as the Postgres database as SQL dump.) Though it would be very unfortunate if upgrading never worked reliably and a full reinstallation would be required each time instead.

Oh great, the forum is back online. It wasn’t accessible since I wrote this post.

I found the problem and could resolve it. The occ script is hardcoded to use the php binary but I needed to use php7.2. So after the first phase of the update I patched that file to use the required PHP version until the Nextcloud version was new enough to support the default php 7.4. Maybe it’s a bad idea to let the user call the first script with PHP explicitly (allowing them to select the correct version) and then suggesting to call another script that uses PHP implicitly (selecting the wrong version). A little more consistency would be helpful here.

But then again, considering the upgrade experience (I had to do several extra steps regarding database indices and such after each upgrade because the automatic updater missed them) and the quality of the Nextcloud application (the calendar in v13 wasn’t exactly robust and responsive, but it’s even worse now in v20, looks ugly, jerky and short entries are even invisible, and of course everything is still slow) and that the Talk application isn’t even available/compatible anymore, I’m not seeing much of a future for Nextcloud. Probably will increase work for alternative solutions to get rid of it again.