欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

Apache遇到的问题 APR not found问题的解决方法

程序员文章站 2022-05-27 13:24:07
#./configure --prefix……检查编辑环境时出现: checking for apr... no configure: error: apr not fo...

#./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

#cd /tmp/52lamp/ //源码存放位置 #tar -zxvf apr-1.4.2.tar.gz //unzip -o apr-1.4.2.zip #cd apr-1.4.2 #./configure #make #make install

再次检查编译环境出现

checking for apr-util... no configure: error: apr-util not found .  please read the documentation.

#./configure –help | grep apr-util --with-apr-util=path    prefix for installed apu or the full path to

下载:http://download.chinaunix.net/download/0001000/472.shtml #tar -zxvf apr-util-1.3.9.tar.gz #cd apr-util-1.3.9 #./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr #make #make install

./configure仍提示apr-util not found,增加--with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util后出现 configure: error: pcre-config for libpcre not found. pcre is required and available from http://pcre.org/

#./configure –help | grep pcre --with-pcre=path        use external pcre library

下载:http://sourceforge.net/projects/pcre #unzip -o pcre-8.10.zip #cd pcre-8.10 #./configure --prefix=/usr/local/pcre #make #make install

继续安装apache/httpd,./configure 时加上参数 --with-apr=/usr/local/apr/ --with-apr-util=/usr/local/apr-util/ --with-pcre=/usr/local/pcre,这个问题就解决了

注意:apache在安装时不会检查参数是否正确,错误的参数会直接被丢弃,不会报告给用户。但可以使用echo $?命令检查是否有错误,当输出结果为0时表示没有错误。

#echo $? 0

#make #make install

复制apache启动文件 #cp /usr/local/httpd/bin/apachectl /sbin/

启动apache #apachectl start

设置apache开机自启动 #vi /etc/rc.d/rc.local 增加一行 /sbin/apachectl start

或者将httpd服务添加到ntsysv服务管理工具 #apachectl stop //关闭apache以免不必要的麻烦 #cp /usr/local/httpd/bin/apachectl /etc/rc.d/init.d/httpd #vi /etc/rc.d/init.d/httpd 修改为 #!/bin/sh # #chkconfig: 345 85 15 //#不能省略,注意空格 #description: httpd for 52lamp 20101016 21:54 //任意字符串 # ......

第二行中345的含义: #       0 - operation completed successfully #       1 - #       2 - usage error #       3 - httpd could not be started #       4 - httpd could not be stopped #       5 - httpd could not be started during a restart

修改有关权限 #cd /etc/rc.d/init.d/ #chmod a+x httpd #chkconfig --add httpd

#ntsysv httpd已经在列表中,按f1可以看到刚才编写的服务描述httpd for 52lamp 20101016 21:54。

#apachectl start #ps -e |grep httpd 23247 ?        00:00:00 httpd 23248 ?        00:00:00 httpd 23249 ?        00:00:00 httpd 23251 ?        00:00:00 httpd 23252 ?        00:00:00 httpd

在浏览器中输入127.0.0.1,看起来一切正常;但是局域网内其他电脑不能访问!

#service iptables stop

如果不想关闭防火墙,放开80端口即可。

#vi /etc/sysconfig/iptables 增加一行-a rh-firewall-1-input -m state --state new -m tcp -p tcp --dport 22 -j accept #service iptables restart //重启防火墙

现在一切ok