PHP Configuration For Ubuntu

Prerequisites

Before starting with this tutorial, make sure you are logged in as a sudo user .

Start by enabling the Ondrej PHP repository:

sudo apt install software-properties-common
sudo add-apt-repository ppa:ondrej/php

Install PHP 7.3 and some of the most common PHP modules:

sudo apt install php7.3 php7.3-common php7.3-opcache php7.3-cli php7.3-gd php7.3-curl php7.3-mysql

To verify the installation, run the following command which will print the PHP version:

php -v
Output
PHP 7.3.1-1+ubuntu18.04.1+deb.sury.org+1 (cli) (built: Jan 13 2019 10:19:33) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.1, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.1-1+ubuntu18.04.1+deb.sury.org+1, Copyright (c) 1999-2018, by Zend Technologies