Install PHP 7.4 on Ubuntu 18.04|16.04
Step 1: Add PHP PPA Repository
We’ll PPA repository which has the latest build packages of PHP. But first install dependent packages.
sudo apt update
sudo apt -y install software-properties-common
Add the repos:
sudo add-apt-repository ppa:sergey-dryabzhinsky/php74
sudo add-apt-repository ppa:sergey-dryabzhinsky/php7-modules
sudo add-apt-repository ppa:sergey-dryabzhinsky/backports
sudo add-apt-repository ppa:sergey-dryabzhinsky/packages
Step 2: Install PHP 7.4
Install PHP 7.4 on Ubuntu using the command:
sudo apt -y install php7.4
Use the next command to install additional packages:
sudo apt install php7.4-xxx
Example:
sudo apt install php74p-mod-{mysql,bcmath,bz2,gd,intl,mbstring,zip,json}