Cannot upgrade to NC 26 due to PHP 7.4

I’ve been scratching my head to the same problem for a while now with the (apparently not full version of the HanssonIT) VMware image I downloaded from the Nextcloud website. Finally, I managed to solve it. Just putting the steps here hoping it might help other in the same predicament. Although, no guarantees, your mileage may vary…

Also, long live the snapshot functionality of ESXi (or any other hypervisor for that matter)! Use it well and use it often, it saved me a lot during my journey to solve this.

Here it begins: I was on NC 25.0.9 and Ubuntu 20.04 LTS when I started, and stuck on PHP 7.4.

  1. First, add the following repository so you can install PHP 8.1
sudo add-apt-repository ppa:ondrej/php 
sudo apt update
  1. Then I updated to PHP 8.1 with these great instructions and script from ernolf:
    Any step by step documentation upgrading NC to 25? - #3 by ernolf
    I’ll repeat the commands I used here, but all credits go to ernolf
    I kept all the old configuration parameters (the script will ask you to keep it or change it).
sudo wget -P /usr/local/bin https://global-social.net/apps/raw/s/php-updater
sudo chmod +x /usr/local/bin/php-updater
sudo php-updater

Should the script no longer be available in the future, you can always do it manually (update the packages and copy the configs).

  1. Manually set the PHP version with this command
for linkgroup in $(ls /var/lib/dpkg/alternatives/ | grep -E "ph(ar|p)"); do sudo update-alternatives --config $linkgroup; done
  1. The Nextcloud configuration of the VM uses php-fpm. Disable php7.4-fpm and enable php8.1-fpm with these commands
sudo a2disconf php7.4-fpm
sudo a2enconf php8.1-fpm
  1. Edit the Apache config to point to php8.1-fpm with nano. (If needed, change the path / name of the .conf file to your deployment.) Change the line that points to the old php7.4-fpm.nextcloud.sock to the new php8.1-fpm.sock (yes, without ‘nextcloud’)
sudo nano /etc/apache2/sites-enabled/nextcloud_http_domain_self_signed.conf
  1. You probably need to (re)install the corresponding version of the APCu package.
sudo apt-get install php8.1-apcu
  1. If needed, edit/create the following ‘apcu.ini’ files
In the following folders:
/etc/php/8.1/mods-available
/etc/php/8.1/fpm
/etc/php/8.1/cli

With the contents:
extension=apcu.so
apc.enable_cli=1
  1. If you use / have used SMB in external storage, you might need to update / reinstall the ‘smbclient.so’ dependency.
sudo apt -y install smbclient cifs-utils libsmbclient-dev php-dev make
sudo pecl install smbclient

Also, add this to your ‘/etc/php/8.1/fpm/php.ini’

'extension=smbclient.so'
  1. Time to finish!
sudo systemctl restart php8.1-fpm
sudo systemctl reload apache2

As you’ve probably deduced by now, I’m definitely no ‘native’ Ubuntu / Linux user. So, some of the steps may not be needed per se or could’ve been more efficient. But, it worked for me, so I hope this is useful for others in the same situation.

After above steps, Nextcloud was happily offering me the next update to 26.0.4 and then after that to 27.0.1 (current release version).

After the (finally) successful PHP update to 8.1, I also upgraded to Ubuntu 22.04 LTS. And Nextcloud kept on running after :slight_smile:

1 Like