源码编译安装httpd

1.准备工作

1.1依赖apr及apr-util1.4以上

description:apache可移值运行环境(portable runtime),提供了一个C数据结构及程序的*库,以达到一个系统可移植层到尽可能多的系统。类似于tomcat的运行环境JVM

1.2 编译安装apr-util-1.6.1、apr-1.7.0为例

tar xf apr-1.7.0.tar.bz2  
cd apr-1.7.0  
./configure  --prefix=/usr/local/apr  
make  
make install   

tar xf apr-util-1.6.1.tar.bz2  
cd apr-util-1.6.1  
./configure  --prefix=/usr/local/apr-util  \  
--with-apr=/usr/local/apr/       #指定 apr的安装路径  
make  
make install    

2. 编译安装httpd

安装依赖库pcre-devel openssl-devel

yum –y install pcre-devel openssl-devel 
tar xf httpd-2.4.41.tar.bz2  
cd httpd-2.4.41  
./configure --prefix=/usr/local/apache  --enable-so --enable-rewrite --enable-ssl  --enable-cgi  --enable-cgid --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/  
make  
make install  

添加环境变量
echo “export PATH=$PATH:/usr/local/apache/bin” >> /etc/profile.d/httpd.sh

3. 源码编译安装php

3.1准备工作

yum -y install libxml2 libxml2-devel bzip2 bzip2-devel  
rpm -ivh libmcrypt-devel-2.5.8-13.el7.x86_64.rpm  
rpm -ivh libmcrypt-devel-2.5.8-13.el7.x86_64.rpm  

3.2 编译安装

tar xf httpd-2.4.41.tar.bz2  
cd httpd-2.4.41  
./configure --prefix=/usr/local/php --with-mysqli --with-openssl \  
--enable-mbstring  \              #muti byte string  
--with-freetype-dir --with-jpeg-dir  --with-png-dir --with-zlib  --with-libxml-dir=/usr --enable-xml --enable-sockets  \  
--with-apxs2=/usr/local/apache/bin/apxs    \   #指定勾子函数路径,php模块化  
--with-config-file-path=/etc  --with-config-file-scan-dir=/etc/php.d  --with-bz2  \  
--enable-maintainer-zts         #支持线程,即worker与event工作模型  
[--enbale=fpm]                  #支持fcgi,如果不使用模块化,编译此  

3.3编辑配置

cp php.ini-production /etc/php.ini   创建php的配置文件  
关联apache  
sed -i "/\<AddType application\/x-gzip .gz .tgz\>/a \    AddType application/x-httpd-php .php\n    AddType   application/x-httpd-php-source .phps"  httpd.conf  
sed  -i  ‘/DirectoryIndex index.html/ s/$/\ index.php/ ‘  httpd.conf

源码编译安装httpd

上一篇:一些公用的JS


下一篇:PHP数据库配置