您的位置:首页 > 运维架构 > Apache

CentOS5下编译安装apache+php

2010-01-13 21:14 453 查看
前段时间研究了下centos下的apache和php的编译安装,一下是我的编译过程,前提是已经安装 好了mysql了

1.下载安装包

用wget :

apache:http://www.apache.org/dist/httpd/httpd-2.2.14.tar.bz2

php:http://cn2.php.net/get/php-5.3.0.tar.bz2/from/us.php.net/mirror

2.解压到/usr/local/src下,先编译apache,在编译php

apache编译参数:

apache:/configure --prefix=/usr/local/apache2 --with-mpm=worker --enable-so --enable-rewrite --enable-cache

--enable-file-cache --enable-disk-cache --enable-mem-cache --enable-deflate --enable-expires --enable-headers

--disable-actions --disable-cgid --disable-cgi --disable-autoindex --disable-userdir --disable-alias --disable-include

--enable-proxy-ajp --enable-proxy --enable-proxy-balancer

make

make install

在apache的编译安装中,一半会报mysqlclient包没有安装,centos下,用yum install mysql-devel就可以了,其他的一些包类似安装就可以

php编译参数:

./configure --prefix=/usr/local/php5 --with-apxs2=/usr/local/apache2/bin/apxs --with-libxml-dir --with-zlib

--with-bz2 --enable-calendar --enable-ftp --with-gd --with-jpeg-dir --with-png-dir --with-zlib-dir --with-freetype-dir

--enable-gd-native-ttf --enable-mbstring --with-mysql --with-mysqli=/usr/bin/mysql_config

--with-mysql-sock=/var/lib/mysql/mysql.sock --enable-sockets --with-xsl --enable-zip

--enable-zend-multibyte --with-curl=/usr --with-openssl

make

make install

到此,apache和php的编译安装基本上就结束了,下面就是一些配置问题了!!

附上我在网上找的部分apache的编译参数的说明:

/configure //配置源代码树 --prefix=/usr/local/apache2 //体系无关文件的顶级安装目录PREFIX ,也就Apache的安装目录。

--enable-module=so //打开 so 模块,so 模块是用来提 DSO 支持的 apache 核心模块

--enable-deflate=shared //支持网页压缩

--enable-expires=shared //支持 HTTP 控制

--enable-rewrite=shared //支持 URL 重写

--enable-cache //支持缓存

--enable-file-cache //支持文件缓存

--enable-mem-cache //支持记忆缓存

--enable-disk-cache //支持磁盘缓存

--enable-static-support //支持静态连接(默认为动态连接)

--enable-static-htpasswd //使用静态连接编译 htpasswd - 管理用于基本认证的用户文件

--enable-static-htdigest //使用静态连接编译 htdigest - 管理用于摘要认证的用户文件

--enable-static-rotatelogs //使用静态连接编译 rotatelogs - 滚动 Apache 日志的管道日志程序

--enable-static-logresolve //使用静态连接编译 logresolve - 解析 Apache 日志中的IP地址为主机名

--enable-static-htdbm //使用静态连接编译 htdbm - 操作 DBM 密码数据库

--enable-static-ab //使用静态连接编译 ab - Apache HTTP 服务器性能测试工具

--enable-static-checkgid //使用静态连接编译 checkgid

--disable-cgid //禁止用一个外部 CGI 守护进程执行CGI脚本

--disable-cgi //禁止编译 CGI 版本的 PHP --disable-userdir //禁止用户从自己的主目录中提供页面

--with-mpm=worker // 让apache以worker方式运行

--enable-authn-dbm=shared // 对动态数据库进行操作。Rewrite时需要。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: