Step 1: Update system
Ensure your system is updated:
sudo apt update
sudo apt upgrade
Step 2: Add SURY PHP PPA repository
Download and store PPA repository in a file on your Debian Server/Desktop. But first, download GPG key.
sudo apt -y install lsb-release apt-transport-https ca-certificates
sudo wget -O /etc/apt/trusted.gpg.d/php.gpg https://packages.sury.org/php/apt.gpg
Then add repository.
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
Step 3: Install PHP 7.4 on Debian 10 / Debian 9
The last step is to Install PHP 7.4 on Debian 10 / Debian 9. Before installation, update system package list on added repositories.
sudo apt update
Then install PHP 7.4 on Debian 10 / Debian 9:
sudo apt -y install php7.4