PHP 7.3 reached end of life on 06 Dec 2021 and is no longer being updated. It's strongly recommended to upgrade to the latest version as soon as possible. You can read the official PHP migration guide here.
Add the PHP 7.3 repository:
sudo add-apt-repository ppa:ondrej/php
Update the package list:
sudo apt update
Install PHP 7.3 and common extensions:
sudo apt install php7.3 php7.3-cli php7.3-common php7.3-json php7.3-opcache php7.3-mysql php7.3-mbstring php7.3-xml php7.3-gd php7.3-curl
Check the installed PHP version:
php -v
You should see output indicating PHP 7.3.x is installed.
Verify PHP configuration:
php -i
This will display detailed PHP configuration information.
Check installed PHP modules:
php -m
This will list all installed PHP modules.