Updating from Nextcloud 15.x to 16.x issues due to PHP 7.0 — it requires PHP 7.1 or newer.

There’s a message when you execute the updater on nextcloud to bring you to version 16 of nextcloud.  It dumps out some dorky message about php7.0 but doesn’t actually tell you unless  you click the link it dumps.  If you do it takes you to some page where they claim php7.0 is insecure and they give you a timeframe where you need to complete an upgrade from something like 7.0 to 7.2 or 7.3 and if you don’t then it’s your fault for running an insecure version of PHP 7.0

The problem is that updating from 7.0 to some other version is more than just updating to 7.2 or 7.3.  You have all sorts of dependencies that also need to be updated. Even though 7.2 or 7.3 gets installed properly those other things such as php7.2-mbstring, php7.2-mysql, etc aren’t automatically updated.  Not all of the files are identified as you likely updated them over time and have forgotten them all and the nextcloud people don’t tell you which ones you need to update.

This web page does reference the names of the modules but anyone who’s got any experience knows, those names don’t always translate to module names and it is left up to you to guess.

https://docs.nextcloud.com/server/15/admin_manual/installation/source_installation.html

After you do this you will attempt to access nextcloud but it will give you this message:

This version of Nextcloud requires at least PHP 7.1
You are currently running 7.0.33-11+ubuntu16.04.1+deb.sury.org+1. Please update your PHP version.

Now of course I just showed you that I updated to 7.2 as 7.1 isn’t an available option for update.

The following link tells you how to resolve that issue:

https://help.nextcloud.com/t/you-are-currently-running-php-7-0-33-0-deb9u3-upgrade-your-php-version/49706/2

Find the post by brakelmann.  He tells you to

sudo a2dismod php7.0

and

sudo a2enmod php7.3

Then you have to restart the apache2 service

sudo service apache2 restart

Of course, what this does is throw this message on any site using the newer PHP

Warning: Use of undefined constant ’direct’ – assumed ‘’direct’’ (this will throw an Error in a future version of PHP) in /var/www/html/domain.com/wp-config.php on line 94

Now we have to spend our time trying to figure that out because nextcloud wants something that breaks other sites.

This site describes the message and commenting it out removes the issue, but to what effect.  I’m guessing that “assumed “direct”” means it is assumed and no longer needed.  The site effectively says the same thing.  But who really knows?

https://wordpress.org/support/topic/probblem-with-php/

Once this was done then we have an issue with zend_extensions.  The version needed is 7.2

The ioncube wizard says the necessary zend_extension line could not be found in the configuration.

it further gives instruction on putting the loader files in /urs/lib/php/20170718 and to edit the /etc/php/7.2/apache2/conf.d php.ini file

Of course the wizard is wrong.  The zend entry is in /etc/php/7.2/apache2/php.ini file.

When you do this and restart apache2 and try to access the site it give you the following:

Fatal error:  THe file /var/www/html/site/libsecure.php was encoded by the ioncube encoder for php 5.6 and cannot run under php 7.1 or later.  Please as the provider of the script to provide a version encoded with ioncube encoder for php 7.1 in Unknown on line 0

The libecure.php is too old and doesn’t appear to support php > 7.0 which means that one must use php 7.0 or earlier.  That eliminates the ability to update nextcloud, which means it will need to be downgraded.