ubuntu卸载php7并安装php5.6

ubuntu16.04版本从默认源安装的php版本为7.x版本,我们都知道php7.0已经舍弃了很多旧版本的函数等内容,这对旧系统来说是致命的,那么,我们就有了安装旧版php的需求,而同一主机安装两个版本的php,如果不做配置会报错。那么,我们就需要:

一、卸载php7.x;

1)如果我们知道在安装php7的时候都安装了那些包及扩展,可以直接使用命令(php_xxx为您安装的php集扩展)来卸载;

sudo apt-get - -purge remove php_xxx
2)不知道安装了那些扩展,可以使用以下方法来卸载;

a、安装aptiude

sudo apt-get install aptitude
b、检索并卸载php现有版本

sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
二、安装旧版php(我这里以php5.6为例)

1)添加支持php5.6源

sudo add-apt-repository ppa:ondrej/php
2)更新ubuntu源

sudo apt-get update
3)安装php5.6及常用组件

sudo apt-get install php5.6
sudo apt-get install php5.6-gd
sudo apt-get install php5.6-mysql
sudo apt-get install php5.6-mbstring
sudo apt-get install php5.6-zip

---------------------
作者:Strip_lue
来源:CSDN
原文:https://blog.csdn.net/lin_bing110/article/details/80702727
版权声明:本文为博主原创文章,转载请附上博文链接!

posted @ 2018-10-31 16:19  燕*昌  阅读(2629)  评论(0编辑  收藏  举报