Debian Stretch Update to PHP 7.4

Install these packages

sudo apt install apt-transport-https lsb-release

Download the signing key

sudo wget -O /etc/apt/trusted.gpg.d/php.gpg

Add Ondrej’s repo to the sources list

sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'

Update the list of available packages

sudo apt update
You can check the PHP packages that you have installed in your server with a previous PHP version to install the same packages with PHP 7.4. To do this, you have to use the command:
sudo php -m
To search the packages that you can install, you have to use the command:
sudo apt search php7.4
To install the PHP 7.4 core you have to use the command:
sudo apt install php7.4 php7.4-common php7.4-cli
Then you have to install the extensions. All the extensions have the prefix «php7.4». To do this, you have to use the command:
sudo apt install php7.4-fpm php7.4-bcmath php7.4-curl php7.4-xml php7.4-gd php7.4-json php7.4-mbstring php7.4-mysql php7.4-readline php7.4-soap php7.4-xsl php7.4-opcache php7.4-zip

sudo apt install -y php7.4-mysql php7.4-dom php7.4-simplexml php7.4-ssh2 php7.4-xml php7.4-xmlreader php7.4-curl php7.4-exif php7.4-ftp php7.4-gd php7.4-iconv php7.4-imagick php7.4-json php7.4-mbstring php7.4-posix php7.4-sockets php7.4-tokenizer
The default CLI version becomes PHP 7.4.
php -v
PHP 7.4.0 (cli) (built: Nov 28 2019 08:38:49) ( NTS )

To activate PHP 7.4 on the server:
Configure the PHP Processor

Find: cgi.fix_pathinfo
Remove semi-colon and set 0

Configure Nginx to Use the PHP Processor

Find out “`
location ~ .php$ {
fastcgi_pass unix:/run/php/php7.0-fpm.sock; —- Remove this line by commenting ’#’

fastcgi_pass unix:/run/php/php7.4-fpm.sock;

sudo /etc/init.d/nginx reload