ubuntu16.04 卸载 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

sudo apt-get install php5.6-curl

 

Apache2重启:

sudo /etc/init.d/apache2 restart

posted @ 2019-03-11 17:00  韭菜笔记本  阅读(503)  评论(0编辑  收藏  举报