今天从Apache官网上(http://httpd.apache.org/下)下载httpd web服务器,采用源码安装执行 ./configure --prefix=/usr/local/apahce2 命令,检查编辑环境时出现“configure: error: APR not found. Please read the documentation.”错误信息,具体日志如下:
[root@localhost httpd-2.4.25]# ./configure --prefix=/usr/local/apache2
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
导致上述错误是因为缺少 apr & apr-util,解决办法:
1、准备工作,下载所需软件包:
wget http://archive.apache.org/dist/apr/apr-1.4.5.tar.gz
wget http://archive.apache.org/dist/apr/apr-util-1.3.12.tar.gz
wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.10/pcre-8.10.zip
2、编译安装:
yum remove apr-util-devel apr apr-util-mysql apr-docs apr-devel apr-util apr-util-docs
3、具体步骤如下:
a:解决apr not found问题
[root@localhost reviewboard]# tar -zxf apr-1.4.5.tar.gz [root@localhost reviewboard]# cd apr-1.4.5 [root@localhost apr-1.4.5]# ./configure --prefix=/usr/local/apr [root@localhost apr-1.4.5]# make && make install
b:解决APR-util not found问题
[root@localhost reviewboard]# tar -zxf apr-util-1.3.12.tar.gz [root@localhost reviewboard]# cd apr-util-1.3.12 [root@localhost apr-util-1.3.12]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr/bin/apr-1-config [root@localhost apr-util-1.3.12]# make && make install
c:解决pcre问题
[root@localhost reviewboard]#unzip -o pcre-8.10.zip [root@localhost reviewboard]#cd pcre-8.10 [root@localhost pcre-8.10]#./configure --prefix=/usr/local/pcre [root@localhost pcre-8.10]#make && make install
4、最后编译Apache时加上如下参数:
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util/ \
--with-pcre=/usr/local/pcre
执行完整命令如下:
[root@localhost httpd-2.4.25]# ./configure --prefix=/usr/local/apache2 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --with-pcre=/usr/local/pcre
成功编译后,执行make && make install 命令即可。