问题:

源码编译安装apache是报下面错误:

#./configure --prefix……检查编辑环境时出现

checking for APR... no

configure: error: APR not found.  Please read the documentation.

可以用./configure help | grep apr 查看帮助。

--with-included-apr     Use bundled copies of APR/APR-Util

--with-apr=PATH         prefix for installed APR or the full path to apr-config

--with-apr-util=PATH    prefix for installed APU or the full path to

安装APR(Apache Portable Runtime )
下载:http://apr.apache.org/download.cgi

  1. #wget http://mirrors.hust.edu.cn/apache//apr/apr-1.5.2.tar.gz

  2. #tar -zxvf apr-1.5.2.tar.gz

  3. #cd apr-1.5.2

  4. # ./configure --prefix=/usr/local/apr

  5. #make &&make install

再次检查编译环境出现

checking for APR-util... no

configure: error: APR-util not found .  Please read the documentation.

  1. #wget http://mirrors.hust.edu.cn/apache//apr/apr-util-1.5.4.tar.gz

  2. #tar -zxvf apr-util-1.5.4.tar.gz

  3. #cd apr-util-1.5.4

  4. #./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr   (--with-apr=/usr/local/apr是一定要加的,否则报错)

  5. #make && make install

 

再次检查编译环境出现:

configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/

  1. #wget https://sourceforge.net/projects/pcre/files/pcre/8.35/pcre-8.35.tar.gz

  2. #tar -xzvf pcre-8.35.tar.gz

  3. #cd pcre-8.35

  4. #./configure --prefix=/usr/local/pcre

  5. #make &&make install


再次检查编译环境出现

checking whether to enable mod_deflate... checking dependencies

checking for zlib location... not found

checking whether to enable mod_deflate... configure: error: mod_deflate has been requested but can not be built due to prerequisite failures

解决方法:

yum install zlib-devel -y

 

继续安装apache./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,之后make&&make install