LAMP: Linux + Apache + Mysql + Php Build Environment

Source: Internet
Author: User
LAMP: LinuxApacheMysqlPhp. The combination is collectively referred to as LAMP. Here we will not discuss the independent individuals here. 1, first prepare the software package, as follows: mysql-5.0.22.tar.gzhttpd-2.2.17.tar.gzphp-5.3.5.tar.gz and above is essential to build the installation package, you can go to each official website to download, as to here why choose

LAMP: LinuxApacheMysqlPhp. The combination is collectively referred to as LAMP. Here we will not discuss the independent individuals here. 1, first prepare the software package, as follows: mysql-5.0.22.tar.gz httpd-2.2.17.tar.gz above is LAMP build essential installation package, can go to each official website to download, as to here why choose

LAMP: Linux + Apache + Mysql + Php. The combination is collectively referred to as LAMP. Here we will not discuss the independent individuals here.

1. Prepare the software package as follows:

Mysql-5.0.22.tar.gz

Httpd-2.2.17.tar.gz

Php-5.3.5.tar.gz

The above is an essential installation package for LAMP construction. You can download the package from various official websites. As for why source code installation is selected here, the rpm package can also be installed, the purpose of source code installation is to give us a more detailed understanding of the complex configuration process in LAMP. The three installation packages do not follow the installation sequence. First, the above three packages are mounted to the/usr/local/src directory in Linux and the executable permissions are granted.

2. Install mysql. The installation method of the mysql rpm package has been described in detail in the previous blog. Here we will introduce the source code compilation and Installation Method of mysql, enter the ELE. Me Centos linux learning environment, run ps-ef | grep mysql to check whether a mysql process is running, and then run some commands to check whether mysql has been installed, the details are as follows:

"Groupadd mysql

Useradd mysql-g mysql // create a mysql user and specify the user to the mysql Group

Tar-zxvf mysql-5.0.22.tar.gz // extract to mysql-5.0.22 directory

"./Configure -- prefix =/usr/local/mysql // here is the installation directory for configuring mysql

"Make

"Make install // install

Cp support-files/my-medium.cnf/etc/my. cnf // copy the configuration file in the current directory to the system configuration file and change it to my. cnf

"Cd/usr/local/mysql // switch to the mysql installation directory

"Chown-R mysql. // change all user permissions of this directory to mysql user

"Chgrp-R mysql. // change all user groups in this directory to the mysql user group

Bin/mysql_install_db -- user = mysql // specify the permission to use data in the mysql directory as mysql

"Chown-R mysql var

Bin/mysqld_safe -- user = mysql & // specify the mysql user to start mysql

Bin/mysqladmin-u root password new password // execute this command to set or change the Database password

Cp/usr/local/src/mysql-5.0.22/support-files/mysql. server/etc/rc. d/init. d/mysql // copy the mysql Startup file to the startup directory of the system.

"Chmod + x/etc/rc. d/init. d/mysql // give the mysql command in the system directory executable permission
"Chkconfig -- add mysql // add mysql startup to the System Auto-start list

Of course, there are other ways to set mysql Automatic startup. The above is the whole process of mysql source code compilation and installation. To verify that mysql installation is successful, you need to execute the following command:

/Usr/local/mysql/bin/mysqld_safe -- user = mysql & // start the mysql database service

"/Usr/local/mysql/bin/mysql-uroot-proot // enter and access mysql Data. If you enter the mysql database command line, the mysql database is successfully installed.

:

3. install apache. The command line is as follows:

Tar-zxvf httpd-2.2.4.tar.gz
Cd httpd-2.2.4
". /Configure -- prefix =/usr/local/apache -- with-mysql =/usr/local/mysql -- enable-module = so -- enable-shared = max // configure association, and start the dynamic Connection Library
"Make
"Make install

Start the apache service, as shown in:

Set apache to automatically start with the operating system. The command is as follows:

Echo "/usr/local/apache/bin/apachectl start">/etc/rc. local // place apache Startup Program commands in the System Startup File. Of course, mysql can also set this

4. Run the following command to install php:

Tar-zxvf php-5.2.2.tar.gz
Cd php-5.2.2
". /Configure -- prefix =/usr/local/php/-- with-mysql =/usr/local/mysql -- with-apxs2 =/usr/local/apache/bin/apxs -- enable-sockets // configure the association between php and apache and mysql.
"Make
"Make install
Cp php. ini-development/usr/local/php/lib/php. ini // note that in the new php configuration file. ini-dist changed to php. ini-development
Vi/usr/local/php/lib/php. ini // here you need to change register_globals = Off to the on mode, and change the time format to local

The above is the PHP installation process.

5. Test

After installing the above packages, you need to change the apache configuration file to resolve the PHP file.

Vi/usr/local/apache/conf/httpd. conf

Use "/" to find AddType application/x-gzip. tgz. Note that it is not marked with #. Find AddType application/x-gzip. add a file after tgz:

Add the file AddType application/x-httpd-php. php. phtml, indicating that php files can be parsed in apache.

Next, check the php dynamic connection library file generated under the apache directory and find whether the libphp5.so file exists in the directory/usr/local/apache/modules.

After a series of installation is complete, use a simple php test page to test whether the LAMP environment is successfully set up.

Vi/usr/local/apache/htdocs/index. php

Content:
Phpinfo ();
?>

Start httpd

Enter http: // ip/index. php In the browser. The following page is displayed, indicating that the request is successful;

It displays the related version information of php, apache, and mysql respectively.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.