无法加载/etc/httpd/modules/mod_auth_basic.so

试图通过编译2.4.7从头开始升级Apache 2.2.3到2.4.7。 我得到以下错误,

[root@test httpd-2.4.7]# /etc/init.d/httpd start Starting httpd: httpd: Syntax error on line 149 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_auth_basic.so into server: /etc/httpd/modules/mod_auth_basic.so: undefined symbol: ap_expr_str_exec [FAILED] 

然而,该文件在那里,

 /etc/httpd/modules/mod_auth_basic.so: ELF 64-bit LSB shared object, AMD x86-64, version 1 (SYSV), not stripped 

我原来的2.2.3configuration文件是在/ etc / httpd中,我运行编译的命令是,

 cd apr-1.5.0/ ./configure --prefix=/usr/local/apr-httpd/ make make install cd ../apr-util-1.5.3/ ./configure --prefix=/usr/local/apr-util-httpd/ --with-apr=/usr/local/apr-httpd/ make make install cd ../pcre-8.32/ ./configure --prefix=/usr/local/pcre-8.32 make make install cd ../httpd-2.4.7/ ./configure --with-apr=/usr/local/apr-httpd/ --with-apr-util=/usr/local/apr-util-httpd/ --with-pcre=/usr/local/pcre-8.32/ --prefix=/etc/httpd make make install 

有任何想法吗 ?

ap_expr_str_exec是Apache httpd 2.4内核中新引入的API函数。 错误是您的运行时链接程序抱怨mod_auth_basic.so模块需要parsingap_expr_str_exec符号,但没有find它。

您可以使用readelf命令的输出来validation它:

 $ readelf -s modules/mod_auth_basic.so Num: Value Size Type Bind Vis Ndx Name ... 3: 0000000000000000 0 NOTYPE GLOBAL DEFAULT UND ap_expr_str_exec ... 

符号索引的UND值意味着它是未定义的,因此必须在运行时解决。

所以,因为你的模块引用了2.4的符号,但是你正在运行的可执行文件没有它,所以看起来好像试图将httpd 2.4模块加载到httpd 2.2实例中。 确保你确定运行正确的httpd二进制文件。