Ubuntu 16.04搭建php5.6 Web服务器环境

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

安装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)

下面关于LAMP相关的内容你可能也喜欢

相关推荐