using apt to build lamp environment under Ubuntu 16.04 LTS
Introduction
First of all, this program is not in the other version of Ubuntu 16.04, but the problem should be small, suitable for beginners to build the environment. Through apt download software Please make sure that your source is configured correctly or otherwise prone to problems.
Update Source
Get a list of the most recent packages that contain information about the package, such as whether the package has been updated. Make sure the following command is complete and there are no errors (this is important, and this error follows).
sudo apt update
sudo apt upgrade
Install Apache2
sudo apt install apache2
Start Apache2
Sudo/etc/init.d/apache2 Start (start)
Sudo/etc/init.d/apache2 Restart (reboot)
Sudo/etc/init.d/apache2 Stop (OFF)
Enter http://localhost or http://127.0.0.1 in the browser, if you see it works! That explains the successful installation of Apache2, Apache's default installation of the site root directory in/var/www/html, of course, can be modified via Apache configuration file.
Installing PHP and APACHE2 support
sudo apt install libapache2-mod-php5 php5
sudo apt install php5-gd php5-mysql (other extension)
Restart the Apache service after installation:
Sudo/etc/init.d/apache2 Restart (reboot)
Write a test.php under/var/www/html to test, everyone should be from window, this is not much to say.
installing the MySQL database
sudo apt install mysql-server
You need to set the password for the database root user (two times) during installation.
Installing PHPMYADMIN-MYSQL database management
sudo apt install phpmyadmin
You need to enter the access password for the root user you just set up during the installation process. Then the phpMyAdmin is connected to the Apache2, the default URL root is/var/www/html,phpmyadmin in the/usr/share/phpmyadmin directory, so use the command:
sudo ln-s/usr/share/phpmyadmin/var/www/html
Enter Http://localhost/phpmyadmin or http://127.0.0.1/phpmyadmin in the browser. Well, it's a familiar taste.
set Ubuntu file to perform read and write permissions
sudo chmod 777/var/www/html