PHP Environment installation (APACHE2 installation)
1. Install Apache, install command: sudo apt-get install apache2
2. Environment configuration:
1) configuration file: Path is/etc/apache2, configuration file is apache2.conf, and there is no http.conf.
2) Default Web site root directory:/var/www/html, use the browser to access the http://localhost can be opened;
3) Modify the Web site root directory:
A, "sudo vim/etc/apache2/apache2.conf"--Find the location of "" and Change "/var/www/" to the new root "/home/www"
B, "sudo vi/etc/apache2/sites-available/000-default.conf"-Find the location of "documentroot/var/www/html" and Change "/var/www /html "/home/www" for the new root directory.
4) Restart Apache server: sudo/etc/init.d/apache2 restart
PHP Configuration
1, update the source list, or install PHP will fail:
Command Line input: vim/etc/apt/source.list
Add the following to the front:
Deb Http://mirrors.aliyun.com/ubuntu/precise main Restricteduniverse Multiverse
Deb Http://mirrors.aliyun.com/ubuntu/precise-security mainrestricted Universe Multiverse
Deb Http://mirrors.aliyun.com/ubuntu/precise-updates mainrestricted Universe Multiverse
Deb http://mirrors.aliyun.com/ubuntu/precise-proposed mainrestricted Universe Multiverse
Deb Http://mirrors.aliyun.com/ubuntu/precise-backports mainrestricted Universe Multiverse
DEB-SRC http://mirrors.aliyun.com/ubuntu/precise mainrestricted Universe Multiverse
DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-securitymain Restricted Universe multiverse
DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-updatesmain Restricted Universe multiverse
DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-proposedmain Restricted Universe multiverse
DEB-SRC Http://mirrors.aliyun.com/ubuntu/precise-backportsmain Restricted Universe multiverse
Apt-get Update//Updates the list
2. Install PHP, install the command: Sudoapt-get install PHP5
3, let Apache support PHP, installation command: sudo apt-get install LIBAPACHE2-MOD-PHP5
4, install PHP5-GD module, installation command: Sudoapt-get install PHP5-GD
5. Let PHP support Curl
1) first check to see if Php5-curl is installed: dpkg-l | grep ' Php5-curl '
2) if not installed, then: Apt-get install Php5-curl
3) Ensure that Extension_dir exists and contains curl.so,
Find Extension_dir:php-i | grep Extension_dir
4) To ensure the existence of/etc/php5/mods-available/curl.ini, the file contents are as follows:
; Configuration for PHP CURL module
; Priority=20
Extension=curl.so
3. MySQL Installation
sudo apt-get install mysql-client-5.5
sudo apt-get install mysql-server-5.5
sudo apt-get install Php5-mysql (associate apache2 with MySQL)
/etc/init.d/mysql start MySQL Service
/etc/init.d/mysql stop to shut down the MySQL service
/etc/init.d/mysql Restart restart MySQL Service
Php+mysql Environment Building in Ubuntu