Upgrade old Nextcloud 10 on PHP 7.3.6?

update_problems
#1

Hi all,

I’ve been trying to upgrade an old old version of Nextcloud for a week now without success. It boils down to having php 7.3.6 on Fedora 30, and Nextcloud telling me that it can’t upgrade from 10 to 11 (and subsequently 12 & 13) with this version of PHP (it should work for 14, 15 & 16) …and Fedora does not package any older version of PHP, not even 7.2 (to not mention that it’s semi-production server running other PHP services that would be interrupted heavily by downgrade and messing around with it…)

Context - Fedora packages were insanely out of date and I made that mistake of using them when I first installed Nextcloud. I understand that upgrading between major versions is not supported so going directly to something that would work with php7.3 isn’t going to work either so I’m trying to go step by step…

Any help would be much appreciated! =(

project@Keyra: nextcloud$ php occ status -v
This version of Nextcloud is not compatible with PHP 7.2.<br/>You are currently running 7.3.6.
project@Keyra: nextcloud$ php occ upgrade -v
This version of Nextcloud is not compatible with PHP 7.2.<br/>You are currently running 7.3.6.
#2

The upgrade is in .js so it should not actually depend on the version of php… I am neither php nor js expert though to be able to figure it out and hack it going. Any directions would be welcome.

#3

I (somewhat) recently upgraded from Owncloud 9.x to NC 15 on Ubuntu.

Maybe my notes will help.

  • The first steps required PHP56, so I installed that and did the upgrade using OCC.
    • I did not reconfigure my web server to use the older php. Web access to Nextcloud did not work until I reached NC14.
  • My notes are Ubuntu specific - on Fedora you’ll have to
    • figure out how to get non-standard versions of php installed
    • change the user from “www-data” to the correct value in the “chown” and “occ” commands.
    • change the web parent folder from /var/www to the correct value for your system.
  • My web server is configured to serve /var/www/nextcloud - that is, the folder containing nextcloud uses the same folder name obtained by unzipping the downloaded nextcloud zip files. If your system is serving nextcloud from a different folder name You’ll need to
    • adjust the folder rename command
      mv nextcloud nextcloud-${OLDVER}
    • rename the extracted nextcloud folder after unzipping it.
    • change the OCC invocation
      sudo -u ${WEBUSER} php5.6 nextcloud/occ upgrade
    • probably replace other occurences of ‘nextcloud’ in my notes…
  • I worked this out on a virtual clone of my server - mistakes only cost me 5 minutes to regenerate the clone. Once the process worked reliably I ran it on the live server with a clone on hand as a backup.
# Install NC10 dependencies
# (I kept adding php5.6-related stuff until occ upgrade stopped complaining...)
add-apt-repository ppa:ondrej/php
apt-get install -y php5.6
apt install php5.6-mysql
apt install php5.6-dom php5.6-XMLWriter php5.6-XMLReader  php5.6-mb php5.6-GD php5.6-SimpleXML php5.6-curl
apt install php5.6-xml php5.6-zip

Download all of the interim versions…

mkdir -p /vcloud/install
cd /vcloud/install
wget https://download.nextcloud.com/server/releases/latest-11.zip
wget https://download.nextcloud.com/server/releases/latest-12.zip
wget https://download.nextcloud.com/server/releases/latest-13.zip
wget https://download.nextcloud.com/server/releases/latest-14.zip
wget https://download.nextcloud.com/server/releases/latest-15zip

I used this code block to update from version to version -

OLDVER=10
NEXTVER=$(echo $(( $OLDVER + 1 )))
# WEBPARENT is the folder that contains your nextcloud folder
WEBPARENT=/var/www
WEBUSER=www-data
cd ${WEBPARENT}
mv nextcloud nextcloud-${OLDVER}
unzip /vcloud/install/latest-${NEXTVER}.zip
cp nextcloud-${OLDVER}/config/config.php nextcloud/config
mv nextcloud-${OLDVER}/apps-aicr/ nextcloud/
#
#  note: the data folder is outside the nextcloud folder on my install, so I didn't need to move it.
#  if your data folder is inside nextcloud, move it to the new folder
# mv nextcloud-${OLDVER}/data/ nextcloud/ 
chown -R ${WEBUSER}:${WEBUSER} nextcloud
sudo -u ${WEBUSER} php5.6 nextcloud/occ upgrade

Repeat the above process with OLDVER=10, 11, and 12 (NC10 -> NC11, NC11 -> NC12 and NC12 -> NC13).

Once you get to NC13, switch from php56 to php72. From the above code block, replace ‘php5.6’ with ‘php’. If php7.3 gives errors you may need to install php7.2 and specify that version for NC13 and maybe NC14.

OLDVER=13
NEXTVER=$(echo $(( $OLDVER + 1 )))
# WEBPARENT is the folder that contains your nextcloud folder
WEBPARENT=/var/www
WEBUSER=www-data
cd ${WEBPARENT}
mv nextcloud nextcloud-${OLDVER}
unzip /vcloud/install/latest-${NEXTVER}.zip
cp nextcloud-${OLDVER}/config/config.php nextcloud/config
mv nextcloud-${OLDVER}/apps-aicr/ nextcloud/
#
#  note: the data folder is outside the nextcloud folder on my install, so I didn't need to move it.
#  if your data folder is inside nextcloud, move it to the new folder
# mv nextcloud-${OLDVER}/data/ nextcloud/ 
chown -R ${WEBUSER}:${WEBUSER} nextcloud
sudo -u ${WEBUSER} php nextcloud/occ upgrade

Repeat for NC14 -> NC15.

Once you’re on NC15 you can use the updater app to reach NC16.

[edits]

  • fix typo in nextcloud wget for NC15
  • Change ‘WEBROOT’ to ‘WEBPARENT’ for clarity
  • Add note about changing any mention of ‘nextcloud’ if NC is not being served from ${WEBPARENT}/nextcloud
#4

I found these notes on stackoverflow on installing multiple versions of php simultaneously:
Php7 and php5 on fedora at the same time

Or - if you don’t want to install the remi repository: Since you don’t need to use the web interface at all when updating, you can copy your nextcloud to another system, do all the upgrades there, then copy it back.