Skip to main content
PHP

How to upgrade PHP version from 7.2 to 7.3 on a Ubuntu Server?

By July 7, 2021July 26th, 2021No Comments

The following are the commands I ran in order to upgrade PHP version from 7.2 to 7.3 for a laravel project.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php;
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install -y php7.3;

# Instantly php version changes
php -v;

# For a Laravel Project

sudo apt-get install php7.3-zip;
sudo apt-get install php7.3-gd;
sudo apt-get install php7.3-xml;
sudo apt-get install php7.3-curl;
sudo apt install php7.3-mysql;

# do this too - https://stackoverflow.com/a/35240511/6275860
# Restart is not needed but we should still do it to see all is well.

sudo service apache2 restart;

# We are good to test now the websites.

The process should be same for the other upgrades as well such as: 7.0 to 7.4, 7.2 to 7.4 etc.