Ubuntu 16.04 Default installation php7.0 environment, but PHP7 current compatibility is not very good, if you install php5 need to clear PHP7 installed package, otherwise will error.
First step: Remove the default and installed PHP packages
sudo dpkg-l | grep php| awk ' {print $} ' |tr ' \ n ' ""
sudo apt-get install aptitude
sudo aptitude purge ' dpkg-l | grep php| awk ' {print $} ' |tr ' \ n ' "" '
Step two: Add PPA, install php5.6
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install php5.6
sudo php-v to view the installation version
Step Three: Install Apache2
The previous step will be installed by default, if not, execute the following command to install
sudo apt install apache2
sudo apt-get install libapache2-mod-php5.6
Step three: Install MySQL
sudo apt install mysql-server mysql-client php5.6-mysql
Mysql_secure_installation
Running Mysql_secure_installation will perform several settings:
A) set a password for the root user
b) Delete Anonymous account
c) Remove the root user from remote login
d) Delete the test library and access to the test library
e) Refresh the authorization form for the changes to take effect
These settings can improve the security of the MySQL library.
Fourth Step: Install phpMyAdmin
sudo apt-get install phpMyAdmin php5.6-mbstring php5.6-gettext
sudo ln-s/usr/share/phpmyadmin/var/www/html/phpmyadmin
Fifth Step: Configure phpMyAdmin
Nano/etc/php/5.6/apache2/php.ini
Display_errors = On (error log appears, two times, change, otherwise invalid)
Extension=php_mbstring.dll (Open mbstring)
sudo dpkg-reconfigure phpmyadmin (reconfiguration phpMyAdmin)
ubuntu16.04 Installation Configuration Php5.6,apache2,mysql