Skip to main content

Upgrade php 7.3 Ubuntu 18.04 LTS

Since Ubuntu 18.04 comes with php 7.2, you must install from the ppa:ondrej repository:

sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.3

Install all the existing php 7.2 modules on php 7.3:

sudo apt install $(apt list --installed | grep php7.2- | cut -d'/' -f1 | sed -e 's/7.2/7.3/g')

Remove old PHP version:

apt purge php7.2 php7.2-common

If running Apache disable existing Apache php7.2 mod:

a2dismod php7.2

Enable Apache php7.3 mod:

a2enmod php7.3

Restart Apache:

systemctl restart apache2