Upgrading PHP to 7.3

Currently running Nextcloud 15.0.5 on Ubuntu 16.0.4 with php 7.0.33. I installed php 7.3, however Nextcloud is still seeing the old version of php.

“* You are currently running PHP 7.0.33-0ubuntu0.16.04.3. Upgrade your PHP version to take advantage of performance and security updates provided by the PHP Group as soon as your distribution supports it.”

If I run php -v I see this:

PHP 7.3.3-1+ubuntu16.04.1+deb.sury.org+1 (cli) (built: Mar 7 2019 20:31:26) ( NTS )
Copyright © 1997-2018 The PHP Group
Zend Engine v3.3.3, Copyright © 1998-2018 Zend Technologies
with Zend OPcache v7.3.3-1+ubuntu16.04.1+deb.sury.org+1, Copyright © 1999-2018, by Zend Technologies

What do I need to do in order for Nextcloud to start using the new version of php?

1 Like

Nextcloud uses whatever you “assigned” your web server runs on.

Running php7.3 on Ubuntu 16.0.4 is not official. Check the source/tutorial how you do it for the solution you want. No one knows what you had done, and no one interests on that too.

BTW, I did have experience with some handicap tutorial that manage to make it looks like php7.3 is installed, yes, looks like only. Check those comments (from other people, if any) of that tutorial you followed too. Used to be quite helpful. Good luck.

Yeah, I did some research before hand and followed this to install the newer version of php.

It’s getting Apache to use 7.3 that I’m having the issue with.

First I did this:

sudo a2dismod php7.0
sudo a2enmod php7.3
sudo service apache2 restart

I then confirmed the selection by running:

sudo update-alternatives --config php

But when apache runs I only get an HTTP Error 500 “This page isn’t working” message.

When I reverse it and go back to 7.0 the site works again.

I had used this command before too. I only remember that I also did a lot of tweaks here and there. It worked but I worried how long can this status last. Because I want a stable NC, finally I go Ubuntu 18.04 which officially comes with php7.2

Did you update the php modules as well? They need to be updated too.

Thank you, apparently I had installed the 7.2 Modules instead of the 7.3 modules. So I went back and installed the 7.3 modules and then enabled php 7.3 again. Had to work through a few issues such as enabling opcache but I’m currently getting a green All Checks Passed notice so hopefully I’m good now.

I did this and it is working on a Raspberry Pi 3+


sudo apt-get update

sudo apt-get install apache2 mariadb-server

At the installation of the MySQL/MariaDB server, you will be prompted to create a root password. Be sure to remember your password as you will need it during Nextcloud database setup.

sudo apt install ca-certificates apt-transport-https

wget -q https://packages.sury.org/php/apt.gpg -O- | sudo apt-key add -

echo "deb https://packages.sury.org/php/ stretch main" | sudo tee /etc/apt/sources.list.d/php.list

sudo apt-get install php7.3 php7.3-cli php7.3-common php7.3-mysql php7.3-fpm php7.3-curl php7.3-opcache libapache2-mod-php7.3 php7.3-mbstring php7.3-xml php7.3-gd php7.3-imagick php7.3-recode php7.3-tidy php7.3-xmlrpc php7.3-bz2 php7.3-intl php7.3-json php7.0-mbstring php7.3-imap php7.3-pspell php7.3-xsl php7.3-zip php-memcache php-redis php7.0-mcrypt php-pear php-zip

sudo a2dismod php7.0

sudo a2enmod php7.3

sudo service apache2 restart

php -version

sudo update-alternatives --config php

mysql --version

sudo systemctl start apache2

sudo systemctl enable apache2