卸载
# 删除php的相关包及配置
$ sudo apt-get autoremove php7*
# 删除关联
$ sudo find /etc -name "*php*" |xargs sudo rm -rf
# 清除dept列表
$ sudo apt purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "` -y
# 检查是否卸载干净(无返回就是卸载完成)
$ dpkg -l | grep php7.0
安装
$ sudo apt install software-properties-common python-software-properties
$ sudo add-apt-repository ppa:ondrej/php && sudo apt-get update
# 安装其他版本的可以修改版本号7.2为其他版本
$ sudo apt install php7.2 -y
安装常用扩展
$ sudo apt install php7.2-fpm php7.2-mysql php7.2-curl php7.2-json php7.2-mbstring php7.2-xml php7.2-intl -y
安装其他扩展(按需安装)
$ sudo apt install php-pear
$ sudo apt install php7.2-bcmath
$ sudo apt install php7.2-bz2
$ sudo apt install php7.2-cgi
$ sudo apt install php7.2-dba
$ sudo apt install php7.2-dev
$ sudo apt install php7.2-enchant
$ sudo apt install php7.2-gd
$ sudo apt install php7.2-gmp
$ sudo apt install php7.2-interbase
$ sudo apt install php7.2-imap
$ sudo apt install php7.2-ldap
$ sudo apt install php7.2-odbc
$ sudo apt install php7.2-opcache
$ sudo apt install php7.2-pgsql
$ sudo apt install php7.2-phpdbg
$ sudo apt install php7.2-pspell
$ sudo apt install php7.2-readline
$ sudo apt install php7.2-recode
$ sudo apt install php7.2-snmp
$ sudo apt install php7.2-soap
$ sudo apt install php7.2-sqlite3
$ sudo apt install php7.2-sybase
$ sudo apt install php7.2-tidy
$ sudo apt install php7.2-xmlrpc
$ sudo apt install php7.2-xsl
$ sudo apt install php7.2-zip
网友评论