Compile PHP into Apache static kernel on Linux

Source: Internet
Author: User
Clarify: There are two ways to integrate Apache into PHP: one is the DSO mode, which calls PHP as an external module of Apache, which increases the flexibility of Apache, however, the performance will be reduced by 5%. Another way is to compile PHP into the Apache kernel.

Clarify: There are two ways to integrate Apache into PHP: one is the DSO mode, which calls PHP as an external module of Apache, which increases the flexibility of Apache, but it will bring about a 5% reduction in performance. Another way is to compile PHP into the Apache kernel, so as to sacrifice the mobility of the future adjustment (every time PHP is re-compiled, but the performance will be higher. This is also true for Perl. In contrast, I prefer to use the second method, that is, to compile PHP into the static kernel of Apache.

1. compile Apache:

1. enter Apache to expand the directory;

2../configure--prefix =/usr/local/apache1.3--disable-module = all \

--Enable-module = access--enable-module = log_config \

--Enable-module = dir--enable-module = mime \ # Basic module of Apache

(Clarification: If the DSO method will be applied in the future,--enable-mdule = so will be added during compilation)

2. install PHP:

1. enter PHP to expand the directory;

2../configure--prefix =/usr/local/php4 \

--With-apache = ../apache_1.3.27 # specify the Apache source code directory.

3. make; make install

3. install Apache:

1. enter Apache to expand the directory;

2../configure--prefix =/usr/local/apache1.3--disable-module = all \

--Enable-module = access--enable-module = log_config \

--Enable-module = dir--enable-module = mime \

--Activate-module = src/modules/php4/libphp4.a # compile the PHP module

3. make; make install

4. Configure Apache:

Corrected the httpd. conf document:

1. Timeout 300 ---> Timeout 120

2. MaxKeepAliveRequests 100

3. KeepAliveTimeout 5

4. ServerSignature on ---> ServerSignature off

5. the Options Indexes FollowSymLinks line deletes indexes (the Options in the directory do not include the index option)

6. change the user and group running Apache to nobody.

7. MaxClients 150 --> MaxClients 1500

(How many basic algorithms does this parameter have? for example, on 2 GB machines, an Apache + PHP process consumes about 4 MB of memory, the maximum efficiency is 2g/4 m * 2 = 1000, and the maximum number of processes is 1000*1.5 = 1500; 1.3 to adjust to more than 256, you must correct the source code before compiling Apache)

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.