Saturday, February 7, 2026

Updating PHP from 7.1 to 7.3 on Ubuntu 18.04 · Andrew Wegner


Introduction

The new server has been up and working for a few yr and a half now. It is nonetheless
working rather well. The factor that I am happiest with is my NextCloud set up. Having
my footage routinely backed up from the telephones is a big time saver. I no
longer want to fret about whether or not or not I grabbed a set of images off the
cellphone or which cellphone has which image. It is multi function place in NextCloud. This
makes it straightforward to search out what I am in search of (and straightforward to backup).

NextCloud runs on PHP, which suggests I must have PHP put in on the server
for it to work. This is not an enormous downside, however the final time I actually used PHP,
it was throughout the transition between PHP 4 and PHP 5. So…some time in the past. I arrange PHP
(and Apache) to host NextCloud and actually simply forgot about it.

Throughout a latest replace of packages on the server – as a result of I do prefer to preserve
all the things up to date. I seen this line throughout the apt-get scroll:

php7.1 module already enabled, not enabling PHP 7.3

Time to determine how you can use that newly set up/upgraded PHP 7.3

What is definitely working?

The very first thing I did was verify which model of PHP was getting used within the terminal:

$ php -v
PHP 7.3.7-2+ubuntu18.04.1+deb.sury.org+1 (cli) (constructed: Jul 25 2019 11:44:59) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.7, Copyright (c) 1998-2018 Zend Applied sciences
    with Zend OPcache v7.3.7-2+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Applied sciences

That is promising. The default model right here is PHP 7.3.7.

However, throwing a fast phpinfo(); collectively and taking a look at what it working by way of
Apache, reveals one thing completely different:

PHP Model 7.1.30-1+ubuntu18.04.1+deb.sury.org+1

Okay. Now I do know which module is outdated. It is the run that’s configured to
be used with Apache.

Verifying what’s put in

I assumed I had PHP 7.3 put in, however I wished to verify earlier than I simply began
disabling and enabling Apache modules.

To substantiate I had PHP 7.3 accessible, I ran this:

$ ls /and so on/apache2/mods-accessible/php*
/and so on/apache2/mods-accessible/php7.1.conf
/and so on/apache2/mods-accessible/php7.1.load
/and so on/apache2/mods-accessible/php7.2.conf
/and so on/apache2/mods-accessible/php7.2.load
/and so on/apache2/mods-accessible/php7.3.conf
/and so on/apache2/mods-accessible/php7.3.load

And a fast verify to see what’s enabled:

$ ls /and so on/apache2/mods-enabled/php*
/and so on/apache2/mods-enabled/php7.1.conf
/and so on/apache2/mods-enabled/php7.1.load

Glorious. I’ve PHP 7.3 accessible, and PHP 7.1 is enabled. That is precisely what
I am seeing.

Updating Apache PHP Module

With PHP 7.3 already put in, I simply must disable PHP 7.1 and allow PHP 7.3.

$ a2dismod php7.1
$ a2enmod php7.3

Then restart Apache to make use of the brand new module.

$ service apache2 restart

Lastly, validate the proper module is enabled:

$ ls /and so on/apache2/mods-enabled/php*
/and so on/apache2/mods-enabled/php7.3.conf
/and so on/apache2/mods-enabled/php7.3.load

One other verify of the phpinfo(); web page too:

PHP Model 7.3.7-2+ubuntu18.04.1+deb.sury.org+1

This matches what php -v output.

We’re carried out! Proper?

Checking NextCloud

With PHP up to date, it was time to ensure the one PHP utility I run nonetheless
labored. I visited my NextCloud URL I arrange CloudFlare. There I used to be greeted
with a clean web page. Oddly, I could not discover any errors in my server logs.

Utilizing the a2dismod and a2enmod instructions from above, I downgraded again to
PHP 7.1. NextCloud labored. I upgraded to PHP 7.2 and it labored. Going again to PHP
7.3, and I used to be again to a clean web page.

Even with out server logs, this indicated that both NextCloud does not assist
PHP 7.3 or I used to be lacking modules. A verify of the system necessities for NextCloud
reveals that PHP 7.3 is supported. That simply means I am lacking some modules.

The documentation additionally features a record of all wanted modules and a pleasant
shell script for straightforward set up. Wanting by that, I discovered the apt
packages I wanted.

$ apt-get set up php7.3-fpm 
php7.3-intl 
php7.3-ldap 
php7.3-imap 
php7.3-gd 
php7.3-pgsql 
php7.3-curl 
php7.3-xml 
php7.3-zip 
php7.3-mbstring 
php7.3-soap 
php7.3-smbclient 
php7.3-json 
php7.3-gmp 
php7.3-bz2

A minute or so later, with these modules now put in, I restarted Apache once more.

$ service apache2 restart

Then I went to my NextCloud URL. The web page loaded as anticipated and my cellphone
sync’d the one image I took as a take a look at to make sure it labored.

Total, this was a extremely easy course of. The most important challenge I bumped into was lacking
a module or two that NextCloud required. Merely putting in all the things it wanted
labored completely.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles