--with-mysql=/web/mysql
--with-xml
--with-gdbm-dir=/usr/lib
--enable-ftp
--enable-inline-optimization
--with-gettext=/usr/lib
--enable-magic-quotes
--enable-safe-mode \\激活安全模式
--enable-bcmath \\打开bcmath函数支持
--enable-memory-limit=yes \\打开运行时内存限制
--enable-wddx \\wddx是一种网站间XML数据交换支持技术,原文意思大致如此
--enable-thread-safety \\配合apache的worker模块
--with-freetype-dir=/usr/local/lib \\打开freetype库支持
# make
# make install
# cp php.ini-recommended /usr/local/lib/php/php.ini
# vi php.ini \\适当的修改php.ini文件
safe_mode = Off \\是否使用安全模式
register_globals = Off \\是否允许注册全局变量
max_execution_time = 30 \\脚本最大执行时间
max_input_time = 60 \\脚本最大输出时间
memory_limit = 20M \\php使用的内存限制
post_max_size = 8M \\php最大传递数据
file_uploads = On \\是否允许http文件传输
upload_max_filesize = 2M \\http件传输文件大小限制
allow_url_fopen = On \\PHP的远程文件打开功能,如果服务器有多用户使用,最好关闭
session.save_handler = mm \\如果编译时加上了mm的共享内存支持,请修改成mm
error_reporting = E_ALL & ~E_NOTICE \\脚本出错报告格式,如果要加强安全,可修改成E_ALL
display_errors = On \\是否显示脚本执行错误
log_errors = On \\是否允许日志记录错误
error_log = /usr/local/apache/logs/php_error.log \\错误日志存放地址
disable_functions = phpinfo, get_cfg_var \\禁止phpinfo,get_cfg_var函数的使用,如果你的服务器就自己一个用就不需要了
# tar zxvf mod_perl-2.0-curent.tar.gz -C /setup
# cd /setup/mod_perl-1.99_10
# perl Makefile.PL MP_APXS=/web/httpd/bin/apxs
# make
# make install
# vi /web/httpd/conf/httpd.conf
\\修改apache配置文件
LoadModule php4_module modules/libphp4.so
LoadModule perl_module modules/mod_perl.so
AddDefaultCharset GB2312
AddHandler cgi-script .cgi
AddHandler cgi-script .pl
PerlRequire "/web/httpd/conf/startup.pl"
AddType application/x-httpd-php .php
AddType text/html .shtml
AddOutputFilter INCLUDES .shtml
DirectoryIndex index.html index.cgi index.shtml index.php
<IfModule mod_deflate.c> \\压缩除图片以外的所有输出内容
<Location />
SetOutputFilter DEFLATE
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
SetEnvIfNoCase Request_URI \
\.(?:gif|jpe?g|png)$ no-gzip dont-vary
Header append Vary User-Agent env=!dont-vary
</Location>
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
CustomLog logs/deflate_log deflate
</IfModule>
ExtendedStatus On
<IfModule mod_limitipconn.c> \\mod_limitipconn模块的配置,适当的修改一下
<Location /somewhere>
MaxConnPerIP 3 \\最大ip并发连接数
NoIPLimit image/* \\对image目录下文件不限制
</Location>
<Location /mp3>
MaxConnPerIP 1
OnlyIPLimit audio/mpeg video \\只对audio/mpeg类型文件限制
</Location>
</IfModule>
# vi startup.pl \\添加一个startup.pl文件预先加载perl模块
use Apache2 ();
# use lib qw(/home/httpd/perl);
# enable if the mod_perl 1.0 compatibility is needed
use Apache::compat ();
# preload all mp2 modules
# use ModPerl::MethodLookup;
# ModPerl::MethodLookup::preload_all_modules();
use ModPerl::Util ();
use Apache::RequestRec ();
use Apache::RequestIO ();
use Apache::RequestUtil ();
use Apache::Server ();