How do I install PHP 8.2 FPM and CLI for Magento ≥ 2.4.6 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.2-cli
aptitude install php8.2-fpm
aptitude install php8.2-bcmath
aptitude install php8.2-mysql
aptitude install php8.2-curl
aptitude install php8.2-gd
aptitude install php8.2-imagick
aptitude install php8.2-intl
aptitude install php8.2-mbstring
aptitude install php8.2-xmlrpc
aptitude install php8.2-xsl
aptitude install php8.2-dev
aptitude install zip php8.2-zip
aptitude install php-pear
aptitude install php8.2-soap
aptitude install php8.2-xml
pecl install timezonedb

Step 3

Step 4

Step 5

Step 6

Step 7

Step 8

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

Step 9