安装php5.6

添加源

sudo add-apt-repository ppa:ondrej/php 

安装php5.6

sudo apt-get update  
sudo apt-get install php5.6  
sudo apt-get install libapache2-mod-php5.6  
sudo apt-get install php5.6-mysql php5.6-mbstring php5.6-mcrypt php5.6-xml  

版本切换

1.从PHP 5.6 切换到 PHP 7.0

sudo a2dismod php5.6
sudo a2enmod php7.0
sudo service apache2 restart
update-alternatives --set php /usr/bin/php7.1

2.从PHP7.0切换到5.6

sudo a2dismod php7.0
sudo a2enmod php5.6
sudo service apache2 restart
sudo update-alternatives --set php /usr/bin/php5.6
Last modification:September 17, 2018
If you think my article is useful to you, please feel free to appreciate