PHP7.4 in Debian

How to install php7.4 and php7.4-fpm in Debian, Deepin, Ubuntu, Mint, etc.

Install the repository
: ~$ apt install gnupg2 –
y ~$ wget -qO – https://packages.sury.org/php/apt.gpg | sudo apt-key add
– ~$ echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php7.x.li

st Update:
~$ apt update
~$ apt upgrade

Install:
~$ apt install php7.4

Install with most commonly used extensions:
~$ sudo apt install php libapache2-mod-php7.4 php7.4-cli php7.4-common php7.4-json php7.4-opcache php7.4-readline libphp7.4-embed php7.4-bz2 php7.4-common php7.4-curl php7.4-dba php7.4-fpm php7.4-gd php7.4-interbase php7.4-intl php7.4-ldap php7.4-mbstring php 7.4-mysql php7.4-pgsql php7.4-phpdbg php7.4-soap php7.4-sqlite3 php7.4-tidy php7.4-xml php7.4-xsl php7.4-zip

Exchanging php version:
~$ update-alternatives –set php /usr/bin/php7.4
~$ update-alternatives –set phar /usr/bin/phar7.4
~$ update-alternatives –set phar.phar /usr/bin/phar.phar7.4

Activating php7.4-fpm:
~$ systemctl disable php*-fpm (swap * for the version of the currently act
ive)~$ systemctl stop php*-
fpm~$ systemctl enable php7.4-f
pm~$ systemctl start php7.4-fp
m~$ systemctl restart apache2