PHP 7.0 reached end of life on 03 Dec 2018 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.
Update the package list:
sudo apt update
Add the Sury PHP repository:
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
Update the package list again:
sudo apt update
Install PHP 7.0 and common extensions:
sudo apt install -y php7.0 php7.0-cli php7.0-common php7.0-curl php7.0-gd php7.0-json php7.0-mbstring php7.0-mysql php7.0-xml
Check the installed PHP version:
php -v
You should see output indicating PHP 7.0.x is installed.
Verify PHP CLI is working:
php -r "echo 'Hello, PHP 7.0!';"
This should output: Hello, PHP 7.0!
Check installed PHP modules:
php -m
This will list all installed PHP modules.