Ubuntu 16.04默認安裝php7.0環境,可是php7目前兼容性並非很好,若是自行安裝php5須要清除php7的已安裝包,不然會報錯。php
移除默認及已安裝的PHP包html
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" " "`mysql
【另外的方法】linux
sudo apt-get --purge remove php7.0*sql
(或者 sudo apt-get --purge remove php5* libapache2-mod-php5)apache
sudo apt-get autoremove php7.0*(php5)服務器
添加 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
安裝Apache2
sudo apt install apache2
sudo apt-get install libapache2-mod-php5.6
安裝MySQL
sudo apt install mysql-server php5.6-mysql root root0x0
sudo apt-get install mysql-client
mysql_secure_installation
安 phpmyadmin
sudo apt-get install phpmyadmin
sudo apt-get install php5.6-mbstring
sudo apt-get install php5.6-gettext
sudo ln -s /usr/share/phpmyadmin /var/www/html/phpmyadmin
配置phpmyadmin
nano /etc/php/5.6/apache2/php.ini
display_errors = On(顯示錯誤日誌,出現兩次,都要改,否則無效)
extension=php_mbstring.dll (開啓mbstring)
sudo dpkg-reconfigure phpmyadmin (從新配置phpmyadmin)php7
下面關於LAMP相關的內容你可能也喜歡:網站
LAMP平臺安裝Xcache和Memcached加速網站運行 http://www.linuxidc.com/Linux/2015-06/118835.htmspa
CentOS 7下搭建LAMP平臺環境 http://www.linuxidc.com/Linux/2015-06/118818.htm
CentOS 6.5系統安裝配置LAMP(Apache+PHP5+MySQL)服務器環境 http://www.linuxidc.com/Linux/2014-12/111030.htm
CentOS 7.2 yum安裝LAMP環境 http://www.linuxidc.com/Linux/2016-11/136766.htm
Ubuntu 14.04 配置 LAMP+phpMyAdmin PHP(5.5.9)開發環境 http://www.linuxidc.com/Linux/2014-10/107924.htm
Ubuntu 14.10 下安裝 LAMP 服務圖文詳解 http://www.linuxidc.com/Linux/2014-12/110082.htm
LAMP結合NFS構建小型博客站點 http://www.linuxidc.com/Linux/2015-08/121029.htm
CentOS7下安裝部署LAMP環境 http://www.linuxidc.com/Linux/2016-04/130653.htm
Ubuntu Server 14.04 LTS下搭建LAMP環境圖文詳解 http://www.linuxidc.com/Linux/2016-12/138758.htm
Ubuntu Server 16.04下配置LAMP環境 http://www.linuxidc.com/Linux/2016-12/138757.htm
Ubuntu 16.04搭建LAMP開發環境 http://www.linuxidc.com/Linux/2016-10/136327.htm
Ubuntu 16.04 LTS安裝Apache2+PHP7.0+MySQL+phpMyAdmin圖文詳解 http://www.linuxidc.com/Linux/2017-02/140098.htm
本文永久更新連接地址:http://www.linuxidc.com/Linux/2017-02/140191.htm