Recent time will learn PHP full stack development, will write a series of articles to summarize the process of learning to encourage each other.
The first article records the installation of the lamp environment
0. Install Apache Web server
Update the system before installing
sudo apt-get update && sudo apt-get Dist-upgrade
Then install Apache
sudo apt-get Install Apache2
At this point in the browser to enter localhost can see "It works!", indicating that the installation was successful.
1. Install MySQL Database
sudo apt-get install Mysql-server Php5-mysql
Then there are some security settings, including root password, Telnet, and so on.
sudo mysql_secure_installation
If you choose to have y/n, it's OK.
2. Install PHP
Install PHP5 and some useful extensions (Php5-curl,php5-imagick, etc.):
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt php5-curl php5-imagick php5-cli
Modify the Apache dir.cof file to allow Apache to prioritize the search for index.php:
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
Then restart Apache Web server:
sudo service apache2 restart
3, modify the root directory of the site
Two configuration files need to be modified
1) Modify/etc/apache2/apache2.conf,找到
,将/var/www/
替换为自己的目录
2) Modify/etc/apache2/sites-available/000-default.conf
,找到DocumentRoot /var/www/html
,将/var/www/html
替换为自己的目录
Then restart Apache.
sudo service apache2 restart
3) Copy the "index.html" file to your own root directory
CP/var/www/html/index.html/own root directory
4. Summary
At this point, the lamp environment is installed, in the future you can develop their own website.
Reference Links:
[1] zh cheese: Ubuntu 14.04 installation lamp (linux,apache,mysql,php)
[2] Ubuntu 14.04 installs Apache
The above on the introduction of the first PHP learning record: Ubuntu1404 lamp installation, including the aspects of the content, I hope that the PHP tutorial interested in a friend helpful.