installation process
Installing Apache2
sudo apt-get install apache2
Installing the PHP module
sudo apt-get install php5
Install MySQL
sudo apt-get install Mysql-server
sudo apt-get install mysql-client
Other module installation
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
Test if Apache is working properly
Open the browser and enter localhost to see if there is an IT works! page display. Directory for/var/www/html, if you need to modify the directory, sudo gedit/etc/apache2/sites-available/000-default.conf,/var/www/html to replace all to become/var/www/, Then restart the Apache Server sudo service apache2 restart
Modify Permissions/var/www
sudo chomod 777/var/www
Installing phpMyAdmin
sudo apt-get install phpMyAdmin
Select Apache2 during the installation process and click OK. The next option is to configure the database and enter the password.
Test phpMyAdmin
sudo ln-s/usr/share/phpmyadmin/var/www
Then run http://localhost/phpmyadmin directly to see if there is any database management software appearing.
Configuration process
- Enable the Mod_rewrite module
sudo a2enmod rewrite
Restart Apache server: sudo/etc/init.d/apache2 restart or sudo service apache2 restart
- Set Apache support. htm. html. php
sudo gedit/etc/apache2/apache2.conf&
Add the following sentence: AddType application/x-httpd-php. php. htm. html
-
Test the PHP page
Edit the mysql_test.php code as follows:
<?php $link = Mysql_ Connect ( "localhost" , "root" , "123" ); if (! $link ) die ( Could not connect: ' . mysql_error ()); else echo "Mysql configuration is correct!" ; Mysql_close ( $link );
?>
The
Access http://localhost/mysql_test.php display ' MySQL is configured correctly ' represents the correct configuration.
The third step here appeared garbled after solution
Open config file sudo gedit/etc/apache2/apache2.conf&
Add the following code: Adddefaultcharset UTF-8
Restart Service (sudo service apache2 restart) takes effect.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Ubuntu under Lamp environment construction