To learn about PhP, we will first build a php development environment. The Linux version is ubuntu14.04.
I. installation and configuration of Apache
1, sudo apt-Get install apache2
Enter the local IP address 127.0.0.1 in Firefox. The default page of apache2 indicates that the installation is successful, as shown in:
The default configuration file for Apache in Ubuntu is/etc/apache2/apache2.conf. The default website root directory is/var/www/html.
2. install PHP
1. sudo apt-Get install PhP5
2, in order to make Apache support PHP, you need to install libapache2-mod-php5 Software Package
Sudo apt-Get install libapache2-mod-php5
3. Restart Apache after installing PHP.
Sudo/etc/init. d/apache2 restart
3. Install MySQL
1. sudo apt-Get install mysql-Server
2, in order to make Apache support MySQL, you need to install libapache2-mod-auth-mysql Software Package
Sudo apt-Get install libapache2-mod-auth-mysql
3. Install the php5-mysql package
Sudo apt-Get install php5-mysql
4. After installation, enter the following command to verify whether the installation is successful. If the installation succeeds, the MySQL environment is displayed.
Mysql-u root-P
4. Test the PHP Runtime Environment
1. In the root directory/var/www/html/of the website, delete index.html and create an index. php file. Add the following content:
2. Input 127.0.0.1 in Firefox and output the following webpage:
So far, the php development environment has been set up.
Lamp Environment Construction