Rapid setup of LAMP environment under Ubuntu process records: Install Apache2: sudoapt-getinstallapache2 install PHP module: sudoapt-getinstallphp5 install Mysqlsudoapt-getinstallmysql-server other modules installation: sudoapt-getinstalllibapache2-mod-php5sudoapt-geti
Quick setup of the LAMP environment in Ubuntu:
Install Apache2:
Sudo apt-get install apache2
Install the PHP module:
Sudo apt-get install php5
Install Mysql
Sudo apt-get install mysql-server
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
The first two are easy to understand. To use apache to parse PHP, you need to use these two modules to find the php engine.
Third, it is used in php operations on mysql databases. Most people have database programming experience, so there is no need to explain this.
The fourth GD database.
Apache2 Configuration
After the above modules are installed, the basic configurations are actually okay, just a few small details
Basically, many configurations are completed in the/etc/apache2 directory and Its subdirectories. Therefore, you must clarify the directory structure.
1. apache root directory
After apache2 is installed, the root directory is under/var/www. You can use http: // localhost/to test whether it is easy to use.
You can also create a new file test.html in the directory to try http: // localhost/test.html.
2. PHP parsing problems
After the installation, it seems that php Parsing is a bit problematic. browsing the php web page will save it, and apache does not parse it as a Web page.
Generally, you need to add XXXX to httpd. conf. This may be true for other linux systems, but ubuntu is a little special.
The apache2 configuration of ubuntu is in the/etc/apache2 directory.
This directory contains an apache2.conf file that contains all the apache2 system configuration information.
Php Parsing is configured in php5.conf and php5.load under/etc/apache2/mod-available. The apache2.conf file does not include these two files, as long as it is included, it is OK.
**************************************** *********
In apache2.conf, find
# Include module configuration:
Include/etc/apache2/mod-enabled/*. load
Include/etc/apache2/mod-enabled/*. conf
Add
Include/etc/apache2/mod-available/php5.load
Include/etc/apache2/mod-available/php5.conf
**************************************** *********
Another way is to link the two files to the directory of the "mod-enabled" directory:
Sudo ln-s/etc/apache2/mod-available/php5.load/etc/apache2/mod-enabled/php5.load
Sudo ln-s/etc/apache2/mod-available/php5.conf/etc/apache2/mod-enabled/php5.conf
This method is better, without damaging the Configuration Structure of apache2 itself.
**************************************** *********
3. Change the default directory of apache2 to the current development directory.
The default directory of apache2 is configured in the/etc/apache2/sites-enabled/00default file.
Find the DocumentRoot item in the file and change/var/www to your Development Directory.
Of course, another way is to create a link to your directory under var/www.
For example, if your directory is in/home/username/phptest
Sudo ln-s/home/username/phptest/var/www/phptest
In this way, you can access your working directory through http: // localhost/phptest.
[Note] the link file name cannot contain ".". Otherwise, apache2 treats it as a file and tries to parse it, which cannot achieve the effect of the link directory.
I personally recommend using the latter method, so that multiple working directories can be developed in parallel.
Common commands in configuration
Restart apache
Sudo/etc/init. d/apache2 restart
Create system link
Sudo ln-s a B