ubuntu 16.04上安装php5.6
php --ini
![](https://images2017.cnblogs.com/blog/575868/201801/575868-20180125132958412-376016710.png)
按下面的步骤,在ubuntu 16.04上面安装成功了 php5.6
dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
apt-get install aptitude
aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
add-apt-repository ppa:ondrej/php
apt-get update
apt-get install php5.6
php -v
vim /etc/nginx/sites-enabled/default
which php
ls /run/php/
ls /run/php/ -al
fg
apt-get install php
php -v
history
apt-get install php5.6-fpm
netstat -tnelp
netstat -atunp
ps aux|grep php
netstat -atunp
netstat -atunp|grep 9000
---------------------------------------------------------------------------------------------------------------
Ubuntu 16.04默认安装php7.0环境,但是php7目前兼容性并不是很好,如果自行安装php5需要清除php7的已安装包,否则会报错。
移除默认及已安装的PHP包
sudo dpkg -l | grep php| awk '{print $2}' |tr "\n" " "
sudo apt-get install aptitude
sudo aptitude purge `dpkg -l | grep php| awk '{print $2}' |tr "\n" " "`
添加 PPA
sudo add-apt-repository ppa:ondrej/php
安装php5.6
sudo apt-get update
sudo apt-get install php5.6
安装扩展
sudo apt-get install php5.6-gd
sudo apt-get install php5.6-mysql