: This article mainly introduces how to build the ubuntuphplamp environment. if you are interested in the PHP Tutorial, refer to it. Installation process
Step 1 install Apache2
Sudo apt-get install apache2
Step 2 install the PHP module
Sudo apt-get install php5
Step 3 install Mysql
Sudo apt-get install mysql-server
Sudo apt-get install mysql-client
Step 4 install other modules
Sudo apt-get install libapache2-mod-php5
Sudo apt-get install libapache2-mod-auth-mysql
Sudo apt-get install php5-mysql
Sudo apt-get install php5-gd
Step 5 test whether Apache works properly
Open your browser and enter localhost to check whether It Works exists! Webpage display. Directory:/var/www
Step 6 modify permissions/var/www
Sudo chomod 777/var/www
Step 7 install phpmyadmin
Sudo apt-get install phpmyadmin
Select apache2 during installation and click OK. The next step is to configure the database and enter the password.
Step 8 test phpmyadmin
Sudo ln-s/usr/share/phpmyadmin/var/www
Then run http: // localhost/phpmyadmin directly to check whether the database management software is available.
Configuration process
Step 1 enable the mod_rewrite module
Sudo a2enmod rewrite
Restart Apache Server: sudo/etc/init. d/apache2 restart or sudo service apache2 restart
Step 2: Set apacheto support .htm. html. php
Sudo gedit/etc/apache2/apache2.conf &
Add the following sentence: AddType application/x-httpd-php. php. htm. html
Step 3 test the php webpage
Edit the mysql_test.php code as follows:
$ Link = mysql_connect ("localhost", "root", "password ");
If (! $ Link)
Die ('could not connect: '. mysql_error ());
Else
Echo "Mysql configuration is correct! ";
Mysql_close ($ link );
?>
When you access http: // localhost/mysql_test.php, 'MySQL configuration is correct 'indicates that the configuration is correct.
Step 4, step 3, the solution after garbled characters appear
Open the configuration file sudo gedit/etc/apache2/apache2.conf &
Add the code below: AddDefaultCharset UTF-8
Restart apache
Sudo service apache2 restart
So far, the configuration is OK.
Original link http://blog.csdn.net/callmeback/article/details/8130190
The above describes how to set up the ubuntu php lamp environment, including some content, and hope to help those who are interested in the PHP Tutorial.