查询卸载已安装PHP
sudo aptitude purge dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
2.通过ppa安装
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6或者sudo apt-get install php5.6-fpm php5.6-cli php5.6-mcrypt
4.配置PHP
sudo vim /etc/php/5.6/fpm/php.ini
打开PHP配置文件,找到cgi.fix_pathinfo选项,去掉它前面的注释分号;,然后将它的值设置为0,如下
cgi.fix_pathinfo=0
5.启用php5-mcrypt:
sudo phpenmod mcrypt
6.重启php5-fpm:
sudo service php5.6-fpm restart