How do I install PHP 8.1 FPM and CLI for Magento ≥ 2.4.4 to Debian 10?

Step 1

aptitude install apt-transport-https lsb-release 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" >> /etc/apt/sources.list
aptitude update

Step 2

aptitude install php8.1-cli
aptitude install php8.1-fpm
aptitude install php8.1-bcmath
aptitude install php8.1-mysql
aptitude install php8.1-curl
aptitude install php8.1-gd
aptitude install php8.1-imagick
aptitude install php8.1-intl
aptitude install php8.1-mbstring
aptitude install php8.1-xmlrpc
aptitude install php8.1-xsl
aptitude install php8.1-dev
aptitude install zip php8.1-zip
aptitude install php-pear
aptitude install php8.1-soap
aptitude install php8.1-xml
pecl install timezonedb

Step 3

Step 4

Step 5

Step 6

Step 7

Step 8

ln -s /etc/php/8.1/common /etc/php/8.1/cli
ln -s /etc/php/8.1/common /etc/php/8.1/fpm

Step 9