Compile and install lamp httpd-2.4.4

Source: Internet
Author: User

Compile and install httpd-2.4.4

Before compiling the httpd-2.4.4, let's discuss how httpd interacts with PHP?

When a client sends a Web request, if the request is a static page of the request, httpd loads the static content directly from the server and returns it to the client. If the request is a dynamic content, for example, if a PHP page is requested, how does httpd handle dynamic requests?

Because dynamic content is implemented by some programming language, this programming language needs to be executed using additional programs. After these scripts are executed, a static page is generated, and return the results to the Apache server. The Apache server returns the results to the client. This is the implementation mechanism of dynamic content.

This program is called the CGI interpreter, which is generated by CGI (Common Gateway Interface. The CGI interpreter can be written in any language. Therefore, the CGI interpreter contains multiple types, different programming languages, and different CGI interpreters, for example, the CGI interpreter of PHP is PHP-CGI.

The interaction between httpd and PHP is different, which leads to different server performance.

Httpd interacts with PHP in three ways:

1. CGI Mode

In this way, when the client requests a PHP page, the Apache server will call CGI to generate a php cgi interpreter to directly explain and execute the PHP script. After execution, a page is generated, then, return the page to an Apache server and return it to the client. However, once the request ends, the CGI interpreter process will be destroyed immediately. Therefore, when there are multiple requests, the CGI interpreter will be loaded and executed repeatedly, which means the execution efficiency is low. In addition, the CGI interpreter is generated only after the request and is not previously generated, so the response speed is relatively slow. In addition, if the number of requests is too large, a large number of processes are generated. Therefore, this method is rarely used.

2. Module

This method directly compiles the PHP function into an Apache module. When you need the PHP function, you only need to load the module. The module cannot be executed independently. It can only be executed after the load is called. In addition, if the PHP function is required, the CGI interpreter of PHP runs in Apache and does not need to generate a new process. This reduces the number of processes.

3. FastCGI/FPM

In this way, the PHP function is used as a PHP server. When the server is started, the FastCGI Process Manager is loaded. the FastCGI Process Manager generates multiple CGI interpreter processes and waits for Web requests, these cgi interpreters are automatically created after the server is started, and these processes are always resident in the memory, so they can respond immediately when there is a Web request, these processes only need to be started once, saving system resources. Therefore, this method is more efficient in Processing dynamic content.

 

 

New Features of httpd 2.4:
1. MPM can be loaded at running fashion;
-- Enable-MPMs-shared = all -- With-MPM = event
2. Event mpm
3. asynchronous read/write
4. Specify the log level for each module and directory;
5. configuration of each request; <if>, <elseif>, <else>;
6. Enhanced expression analyzer;
7. keepalive timeout in milliseconds;
8. The namevirtualhost command is no longer required for domain name-based virtual hosts;
9. Reduced memory usage;
10. You can use custom variables in the configuration file;

 

 

Follow these steps to compile and install the httpd-2.4.4:

1. Compile and install APR and APR-util

The source code packages used here are apr-1.5.1.tar.bz2and apr-util-1.5.3.tar.bz2.

The httpd-2.4.4 needs a newer version of APR and APR-util, so it needs to be upgraded in advance. There are two upgrade Methods: One is through source code compilation and installation, and the other is to directly upgrade the RPM package. Directly upgrade the RPM package to overwrite the original file. Here we select to compile the source code.

(1), compile and install the apr-1.5.1, the compilation steps are as follows:

# Tar-jxf apr-1.5.1.tar.bz2

# Cd apr-1.5.1

#./Configure -- prefix =/usr/local/APR # specify the APR installation directory

# Make

# Make install

(2) Compile and install apr-util-1.5.3.tar.bz2. The compilation procedure is as follows:

# Tar-jxf apr-util-1.5.3

# Cd apr-util-1.5.3

#./Configure -- prefix =/usr/local/APR -- With-Apr =/usr/local/APR (specify where APR is located)

# Make

# Make install

 

(3), the httpd-2.4.4 compilation process also depends on the PCRE-devel software package, need to be installed in advance.

Yum install PCRE-devel

 

2. Compile and install httpd-2.4.4

This article is from the "how to learn from Linux" blog!

Compile and install lamp httpd-2.4.4

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.