On Linux, compile PHP into the Apache static kernel-Linux Enterprise Application-Linux server application information. The following is a detailed description. Note: 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, it will reduce the performance by 5%. Another way is to compile PHP into the Apache kernel, which sacrifices the flexibility of future adjustments (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. Go to Apache to expand the directory;
2../configure--prefix =/usr/local/apache1.3--disable-module = all \
--Activate-module = src/modules/php4/libphp4.a # compile the PHP module
3. make; make install
4. Configure Apache:
Modify httpd. conf:
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
(This parameter has a basic algorithm, such as a 2 GB machine. An Apache + PHP process consumes about 4 MB of memory, the maximum number of processes is 2g/4 m * 2 = 1000, and the maximum number of processes is 1000*1.5 = 1500; 1.3 to be adjusted to higher than 256, you must modify the source code before compiling Apache)
(For apache2.0, set MaxClients 150 --> MaxClients 1500 in the worker MPM field)
8. Add index. php after DirectoryIndex index.html. var.
9. Find the section containing a large number of AddType commands and add the following line: AddType application/x-httpd-php. php
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.