两个版本要同时存在

先加入php的最新源

sudo add-apt-repository ppa:ondrej/php  

咦,报失败,找不到add-apt-repository这个命令,查查看是哪个包的:

sudo apt-file search add-apt-repository  

我去,apt-file也没装,装吧,然后更新一把:

sudo apt-get install apt-file  
sudo apt-file update  

再搜:

sudo apt-file search add-apt-repository  
software-properties-common: /usr/bin/add-apt-repository  
software-properties-common: /usr/share/man/man1/add-apt-repository.1.gz  

原来在software-properties-common这个包里,装上吧

sudo apt-get install software-properties-common  
sudo add-apt-repository ppa:ondrej/php  

再装php5和php7

sudo apt-get install php5.6 php5.6-common php5.6-cli php5.6-fpm php5.6-readline php5.6-mysql php5.6-sybase php5.6-mbstring php5.6-sqlite3 php5.6-json php5.6-curl php5.6-gd

sudo apt-get install php7.1 php7.1-common php7.1-cli php7.1-fpm php7.1-readline php7.1-mysql php7.1-sybase php7.1-mbstring php7.1-sqlite3 php7.1-json php7.1-curl php7.1-gd  

搞定。

comments powered by Disqus