说明:Apache整合PHP 有两种方式:一种是DSO模式,把PHP当作Apache的外部模块来调用,这样增加了Apache的灵活性,但会带来5%的性能降低;另一种方式是把 PHP编译进Apache的内核,这样牺牲了以后调整的灵活性(每次对PHP的重新编译,都需要再次编译Apache),但性能会高一些。对Perl也是如此。相比之下,本人更愿意使用第二种方式,即把PHP编译进Apache的静态内核。
一.编译Apache:
1. 进入Apache展开目录;
2. ./configure - -prefix=/usr/local/apache1.3 - -disable-module=all\
- -enable-module=access - -enable-module=log_config \
- -enable-module=dir - -enable-module=mime \ ##Apache工作的基本模块
(说明:如果以后使用DSO方式,则编译时加上 - -enable-mdule=so)
二.安装PHP:
1. 进入PHP展开目录;
2. ./configure - -prefix=/usr/local/php4 \
- -with-apache=../apache_1.3.27 ##这里指定Apache的源代码目录
3. make;make install
三.安装Apache:
1. 进入Apache展开目录;
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 ##把PHP模块编译进去
3. make;make install
四。配置Apache:
修改httpd.conf文档:
1.Timeout 300--->Timeout 120
2.MaxKeepAliveRequests 100
3.KeepAliveTimeout 5
4.ServerSignature on--->ServerSignature off
5.Options Indexes FollowSymLinks 行把indexes删掉(目录的Options不要带index选项)
6.将Apache运行的用户和组改为nobody
