install php 7.3 ubuntu 18.04 code example

Example 1: install php 7.3 ubuntu

sudo apt install php7.3-cli php7.3-fpm php7.3-json php7.3-pdo php7.3-mysql php7.3-zip php7.3-gd  php7.3-mbstring php7.3-curl php7.3-xml php7.3-bcmath php7.3-json

Example 2: install php 5.6 on ubuntu 18.04

$ sudo add-apt-repository ppa:ondrej/php

Example 3: install php 7.1 on ubuntu 18.04

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

Example 4: install php 7.4 ubuntu

sudo apt update
sudo apt install php php-cli php-fpm php-json php-pdo php-mysql php-zip php-gd  php-mbstring php-curl php-xml php-pear php-bcmath

Example 5: install php 7.3 ubuntu

sudo add-apt-repository ppa:ondrej/phpsudo apt-get update