First, environmental installation
1. Install Apache2
sudo apt-get install apache2
Open in Browser after installation: http://localhost/or http://127.0.0.1
If the IT works! proves the Apache installation is successful.
2. Install PHP
sudo apt-get install php5
sudo apt-get install LIBAPACHE2-MOD-PHP5
Sudo/etc/init.d/apache2 restart
Test:
sudo vi/var/www/testphp.php
Write PHP works! Save Exit VI.
Then enter http://127.0.0.1/testphp.php or http://localhost/testphp.php in the browser
If the PHP works! is displayed Indicates that the PHP configuration was successful.
3. Install MySQL
sudo apt-get install Mysql-server
Set the root password when prompted during Setup.
Note: Modify Password:
Mysql-uroot-p
Mysql>use MySQL;
Mysql>update user Set Password=password (' New password ') WHERE user= ' root ';
Mysql>exit
Restart MySQL, or refresh the permissions.
Reboot: sudo/etc/init.d/mysql Restart or restart MySQL
4, let Apache, PHP support MySQL
sudo apt-get install Libapache2-mod-auth-mysql
sudo apt-get install Php5-mysql
Sudo/etc/init.d/apache2 restart
The installation of the ubuntu+apache2+php 5+mysql is complete.
Tips:
/etc/apache2/under:
1, apache2.conf is the main configuration file, httpd.conf user profile
2, the virtual directory in the httpd.conf
DocumentRoot "Path"
ServerName Name
#Listen 127.0.0.1:80 #注意这个文件中不能写上监听, if you have to write, then you need to apache2.conf the include/etc/apache2/ports.conf to comment out, Because the ports.conf is already listening to port 80.
3, directory settings in/etc/apache2/sites-enabled/000-default can set up a virtual host
4, PHP.ini:/etc/php5/apache2/php.ini
5, MYSQL.CNF:/etc/mysql/my.cnf
4, restart Apache:/etc/init.d/apache2 restart
5, restart Mysql:sudo/etc/init.d/mysql restart or restart MySQL
6. log file:/var/log/apache2/
Second, the GD library installation
sudo apt-get install PHP5-GD
Sudo/etc/init.d/apache2 restart
third, curl extended installation
sudo apt-get install Php5-curl
Sudo/etc/init.d/apache2 restart