在Debian系统中更新和升级PHP的步骤如下:
sudo apt update
sudo apt upgrade php*
sudo apt install php8.2 php8.2-cli php8.2-{bz2,curl,mbstring,intl}
如果需要FPM支持或者用于Apache的模块,也可以安装:
sudo apt install php8.2-fpm # for FPM support
# or
sudo apt install libapache2-mod-php8.2 # for Apache module support
sudo apt purge php8.1*
sudo systemctl restart apache2
或者(以Nginx为例):
sudo systemctl restart nginx
php -v
sudo dpkg -l | grep php | tee packages.txt
sudo cp /etc/php/8.2/fpm/pool.d/www.conf{,_bak}
sudo apt install apt-transport-https
sudo curl -sSLo /usr/share/keyrings/deb.sury.org-php.gpg https://packages.sury.org/php/apt.gpg
sudo sh -c 'echo "deb [signed-by/usr/share/keyrings/deb.sury.org-php.gpg] https://packages.sury.org/php/ $(lsb_release -sc) main" > /etc/apt/sources.list.d/php.list'
sudo apt update
sudo apt install php8.3 php8.3-cli php8.3-{bz2,curl,mbstring,intl}
如果需要FPM支持或者用于Apache的模块,也可以安装:
sudo apt install php8.3-fpm # for FPM support
# or
sudo apt install libapache2-mod-php8.3 # for Apache module support
sudo apt purge php8.2*
sudo systemctl restart php8.3-fpm.service
sudo systemctl restart apache2
或者(以Nginx为例):
sudo systemctl restart php8.3-fpm.service
sudo systemctl restart nginx
php -v
请注意,以上命令可能会根据你的具体需求和Debian版本有所不同。在执行任何升级步骤之前,请确保已经备份了所有重要的数据和配置。