apache启动报错类似于”Cannot load modules/mod_dir.so”
kevin.Zhu 发布于:2013-1-16 0:14 分类:Apache 有 12 人浏览,获得评论 0 条
今天在redhat 5.5上编译安装lamp环境,不料中招,用以前在redhat6上面的方法,会报错,下面是解决方法
编译参数:./configure –prefix=/usr/local/apache –enable-so –enable-mods-shared=most –enable-rewrite=share –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util/ –enable-cache –enable-file-cache –enable-mem-cache –enable-disk-cache –with-mpm=prefork
启动报错:
[root@localhost weihu]# /usr/local/apache/bin/httpd -k start
httpd: Syntax error on line 144 of /usr/local/apache/conf/httpd.conf: Cannot load modules/mod_dir.so into server: /usr/local/apache/modules/mod_dir.so: undefined symbol: apr_array_clear
意思就是没法读取mod_dir.so,但实际上这个模块是有的
实际上是apr和apr-util的问题
需要在编译apache的时候加入 –with-included-apr 这个参数
加入之后编译 依然报错:configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
意思是要你把apr和apr-util的源码放入httpd-2.4.4/srclib 下
那么 我们将apr-xxx 和apr-util-xxx 的源码放入httpd-2.4.4/srclib 并改名去掉版本号
将编译参数简化为:./configure –prefix=/usr/local/apache –enable-so –enable-mods-shared=most –enable-rewrite=share –with-included-apr –with-included-apr-util –enable-cache –enable-file-cache –enable-mem-cache –enable-disk-cache –with-mpm=prefork
编译通过。问题解决
编译参数:./configure –prefix=/usr/local/apache –enable-so –enable-mods-shared=most –enable-rewrite=share –with-apr=/usr/local/apr –with-apr-util=/usr/local/apr-util/ –enable-cache –enable-file-cache –enable-mem-cache –enable-disk-cache –with-mpm=prefork
启动报错:
[root@localhost weihu]# /usr/local/apache/bin/httpd -k start
httpd: Syntax error on line 144 of /usr/local/apache/conf/httpd.conf: Cannot load modules/mod_dir.so into server: /usr/local/apache/modules/mod_dir.so: undefined symbol: apr_array_clear
意思就是没法读取mod_dir.so,但实际上这个模块是有的
实际上是apr和apr-util的问题
需要在编译apache的时候加入 –with-included-apr 这个参数
加入之后编译 依然报错:configure: error: Bundled APR requested but not found at ./srclib/. Download and unpack the corresponding apr and apr-util packages to ./srclib/.
意思是要你把apr和apr-util的源码放入httpd-2.4.4/srclib 下
那么 我们将apr-xxx 和apr-util-xxx 的源码放入httpd-2.4.4/srclib 并改名去掉版本号
将编译参数简化为:./configure –prefix=/usr/local/apache –enable-so –enable-mods-shared=most –enable-rewrite=share –with-included-apr –with-included-apr-util –enable-cache –enable-file-cache –enable-mem-cache –enable-disk-cache –with-mpm=prefork
编译通过。问题解决