Debian11+PHP8.2

更新系统以及添加sury库

sudo apt update
sudo apt -y upgrade
sudo apt install -y lsb-release ca-certificates apt-transport-https software-properties-common gnupg2
echo "deb https://packages.sury.org/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/sury-php.list
wget -qO - https://packages.sury.org/php/apt.gpg | sudo apt-key add -
sudo apt update 

安装PHP以及常用扩展

sudo apt install php8.2 php8.2-bcmath php8.2-bz2 php8.2-cgi php8.2-cli php8.2-common php8.2-curl php8.2-dev php8.2-enchant php8.2-fpm php8.2-gd  php8.2-http php8.2-igbinary php8.2-http php8.2-imagick php8.2-imap php8.2-intl php8.2-mbstring php8.2-mcrypt php8.2-memcached php8.2-memcache php8.2-msgpack php8.2-mysql php8.2-oauth php8.2-odbc php8.2-opcache php8.2-pgsql php8.2-redis php8.2-snmp php8.2-soap php8.2-sqlite3 php8.2-solr php8.2-ssh2 php8.2-stomp  php8.2-tidy php8.2-uuid php8.2-xdebug  php8.2-xml php8.2-xmlrpc php8.2-yaml php8.2-xsl php8.2-zip php8.2-zmq php8.2-raphf

PHP 7.4

sudo apt install php7.4 php7.4-bcmath php7.4-bz2 php7.4-cgi php7.4-cli php7.4-common php7.4-curl php7.4-dev php7.4-enchant php7.4-fpm php7.4-gd php7.4-grpc php7.4-http php7.4-igbinary php7.4-http php7.4-imagick php7.4-inotify php7.4-imap php7.4-intl php7.4-mbstring php7.4-mcrypt php7.4-memcached php7.4-memcache php7.4-msgpack php7.4-mysql php7.4-oauth php7.4-odbc php7.4-opcache php7.4-pgsql php7.4-redis php7.4-snmp php7.4-soap php7.4-sqlite3 php7.4-solr php7.4-ssh2 php7.4-stomp php7.4-tidy php7.4-uuid php7.4-xdebug php7.4-xhprof php7.4-xml php7.4-xmlrpc php7.4-yaml php7.4-xsl php7.4-zip php7.4-zmq php7.4-raphf

检查

php -v
php -m

参考

How To Install PHP 8.0 on Debian 11/10/9