install php 7.4 debian Buster

2022-11-11

add gpg key from packages.sury.org repo to apt package manager

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
apt -y install lsb-release apt-transport-https ca-certificates 

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" | tee /etc/apt/sources.list.d/php.list

apt update

apt install php7.4-fpm php7.4-xml php7.4-mysql php7.4-mcrypt php7.4-mbstring php7.4-json php7.4-curl php7.4-cli php7.4-common

/etc/init.d/php7.4-fpm start

ls /var/run/php/php7.4-*

/var/run/php/php7.4-fpm.pid /var/run/php/php7.4-fpm.sock

info: if any GPG error with signing then :
apt-key adv --fetch-keys 'https://packages.sury.org/php/apt.gpg' > /dev/null 2>&1

now you are able to connect via nginx fcgi_pass to php 7.4 socket via unix://var/run/php/php7.4-fpm.sock

nginx vhost php conf - prod

1
2
3
4
5
6
7
8
9
10
     location ~ \.php$ {
try_files $uri =404;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php/php7.4-fpm.sock;
include fastcgi_params;
fastcgi_keep_conn on;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
}

done

info: installing php 7.4 in fpm mode