Linux ubuntu and centos can quickly build the LAMP environment, centoslamp
 
Install the lamp environment in linux. The following describes how to quickly install the LAMP environment under ubuntu and centos.
 
 
First, let's take a look at the LAMP environment (from Baidu encyclopedia ):
 
Linux + Apache + Mysql/MariaDB + Perl/PHP/Python is a group of open-source software commonly used to build dynamic websites or servers. They are independent programs, however, because it is often used together, it has a higher degree of compatibility and forms a powerful Web application platform. With the rapid development of open source, open source code LAMP has been integrated with J2EE and. net commercial software has formed a three-pronged trend, and the software development project has a low investment cost in software, so it has received the attention of the entire IT industry. More than 70% of website traffic is provided by LAMP, which is the most powerful website solution.
 
Software Components
 
 
Linux 
Linux is a free open-source software, which means that the source code is available in the operating system. 
Apache 
Apache is the most popular open source WEB server software. 
MySQL 
MySQL is a multi-threaded, multi-user SQL database management system. 
MySQL is already purchased by Oracle from SUN in January 27, 2010. SUN initially acquired MySQL in February 26, 2008. 
PHP, Perl, or Python 
PHP is a programming language originally designed to produce dynamic websites. PHP is mainly used for server applications. Perl is similar to Python. 
 
 
 
 
First, we will introduce the first method for quick installation in centos:
 
Now configure the required components for the system and upgrade the system.
 
 
Yum-y update 
Yum-y install gcc-c ++ autoconf automake libtool libevent-devel gmp-devel 
Yum-y install gd-devel freetype-devel fontconfig-devel libjpeg-devel zlib-devel pcre-devel 
Yum-y install ncurses-devel libmcrypt mhash
 
Install mysql 
Yum-y install mysql-server mysql-devel
 
Install apache 
Yum-y install httpd-devel
 
Install phpYum-y install php53 * 
 
 
Start apache and MySQL 
/Etc/init. d/httpd restart 
/Etc/init. d/mysqld restart 
So far, our LAMP environment has been set up. Now, let's test whether the environment is set up successfully and check the configuration information. 
Vi/var/www/html/info. php 
<? Php 
Phpinfo (); 
?> 
Upload the/var/www/html/directory and access it with http: // yourip/info. php to view the php information. 
The short label mode is not enabled, so it cannot be displayed normally. You can find short_open_tag in php and ini and change its value to on.. 
 
 
Set httpd and MySQL to start up. 
Chkconfig httpd on 
Chkconfig mysqld on 
 
 
Supplement: configuration file locations 
/Etc/my. cnf MySQL configuration file 
/Etc/httpd/apache configuration file 
/Etc/php. ini php configuration file 
/Var/www/html/website storage directory 
 
 
Then, the following is a quick installation method 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 phpmyadmin
 
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.
 
 
 
The following are some precautions:
 
After installing the LAMP environment, I tested and found that the PHP webpage was not displayed, but the PHP webpage file was downloaded because of a problem in apache configuration, you just need to set it.
 
 
The following is a simple configuration of apache:
 
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.
 
Restart apachesudo/etc/init. d/apache2 restart
 
Establish system connection sudo ln-s a B
 
 
Reference: Baidu Library
 
 
 
Build the LAMP environment. Which of the following is better for Ubuntu Server and CentOS in Linux? 
CentOS is obviously more stable, and there are many online tutorials.
How can I check whether the lamp environment is successfully built in linux? I installed centos_55 on VMware Workstation.
 
Create a PHP file with the content:
<? Php
Phpinfo ();
?>
Access and check the server information. The installation is successful!