Stuck Upgradeing from 15.0.14 to 16.0.11

Nextcloud version 15.0.14:
Operating system and version Ubuntu 16.04.7 LTS:
Apache or nginx version Apache/2.4.18 (Ubuntu):
PHP version 7.2:

The issue you are facing:

I used the Updater to upgrade to 15.0.14 from whatever I was on before. Then updater told me “The updater is disabled for this update - please update manually.”
I get stuck when I try to upgrade with $ sudo -u www-data php occ upgrade. I get the following error:

An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occurred in driver: could not find driver in /var/www/nextcloud/lib/private/DB/Connection.php:64

Stack Trace:

Is this the first time you’ve seen this error? Y though I’ve restored the server from a snapshot and repeated with the same results.

Steps to replicate it:

  1. Follow this documentation with the exception of backup. I made a snapshot of the server instead. Upgrade manually — Nextcloud latest Administration Manual latest documentation
  2. When I reach sudo -u www-data php occ upgrade I get: This version of Nextcloud requires at least PHP 7.1
    You are currently running 7.0.33-0ubuntu0.16.04.16. Please update your PHP version. I update to 7.2 following this answer on ask ubuntu:
  3. I then try sudo -u www-data php occ upgrade again and get the above error.
  4. php -m does not list pdo_mysql. I tried uncommenting in /etc/php/7.2/apache2/php.ini but that did not help.

The output of your Nextcloud log in Admin > Logging:

I can't get that from the webclient as it is not operational at the moment

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

root@LAMP-NC:/var/www/nextcloud# cat config/config.php
$CONFIG = array (
  'instanceid' => '***********',
  'passwordsalt' => '****************',
  'secret' => '********************************',
  'trusted_domains' =>
  array (
    0 => '',
  'datadirectory' => '/var/www/nextcloud/data',
  'overwrite.cli.url' => '',
  'dbtype' => 'mysql',
  'version' => '',
  'dbname' => 'nextcloud_db',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud_user',
  'dbpassword' => '********',
  'installed' => true,
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'updater.secret' => '******************,
  '' => 'production',   

release channel was on stable, I changed it to try and get the updater to work

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

syslog appears to contain firewall activity for the most part

you call php from your command line, but which version is it?

php -v

If this is still php 7.0, then the php command for php 7.2 is different

ls /usr/bin | grep php

so perhaps it has to be sudo -u www-data php7.2 occ upgrade

Also make sure the database stuff is loaded for the CLI (command line interface) version: