添加GPG
wget -O /etc/apt/trusted.gpg.d/php.gpg https://mirror.xtom.com.hk/sury/php/apt.gpg
安装GPG
apt-get install apt-transport-https
添加sury软件下载源
echo "deb https://mirror.xtom.com.hk/sury/php/ $(lsb_release -sc) main" | sudo tee /etc/apt/sources.list.d/php.list
获取软件更新
apt-get update
下载安装软件
apt-get install libapache2-mod-php php7.2-fpm php7.2-mysql php7.2-curl php7.2-gd php7.2-xml php7.2-xmlrpc php7.2-zip php7.2-opcache php7.2-mb_string -y
设置php7.2
sed -i 's/;cgi.fix_pathinfo=1/cgi.fix_pathinfo=0/' /etc/php/7.2/fpm/php.ini
重启php7.2-fpm
systemctl restart php7.2-fpm
查看php7.2-fpm状态
systemctl status php7.2-fpm
如果想要安装其他拓展可以,通过如下命令查看
apt-cache search php7.2