I. Environment Installation
1. Install apache2
Sudo apt-get install apache2
After installation, open http: // localhost/or http: // 127.0.0.1 in the browser.
If It works appears! Verify that apache is successfully installed.
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 to php works! Save and exit vi.
Enter http: // 127.0.0.1/testphp. php or http: // localhost/testphp. php in the browser.
If php works is displayed! Indicates that the php configuration is successful.
3. Install MYSQL
Sudo apt-get install mysql-server
Set the root password as prompted during installation.
Note: change the password:
Mysql-uroot-p
Mysql> use mysql;
Mysql> update user set password = PASSWORD ('new password') WHERE user = 'root ';
Mysql> exit
Restart mysql or refresh permissions.
Restart: sudo/etc/init. d/mysql restart or restart mysql
4. Make apache and php support mysql
Sudo apt-get install libapache2-mod-auth-mysql
Sudo apt-get install php5-mysql
Sudo/etc/init. d/apache2 restart
So far, Ubuntu + apache2 + php 5 + mysql has been installed.
Tip:
/Etc/apache2:
1. apache2.conf is the main configuration file and the httpd. conf user configuration file.
2. The virtual directory is in httpd. conf.
DocumentRoot "path"
ServerName
# Listen 127.0.0.1: 80 # note that you cannot write a listener in this file. If you must write a listener, you must first include/etc/apache2/ports in apache2.conf. conf to comment out, because ports. port 80 has been monitored in conf
3. You can set the virtual host in/etc/apache2/sites-enabled/000-default.
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/
Ii. GD library Installation
Sudo apt-get install php5-gd
Sudo/etc/init. d/apache2 restart
Iii. curl extension Installation
Sudo apt-get install php5-curl
Sudo/etc/init. d/apache2 restart