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

无法加载 /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.3 配置文件在 /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

有任何想法吗 ?

答案1

ap_expr_str_exec是一个 API 函数,新推出在 Apache httpd 2.4 核心中。错误是您的运行时链接器抱怨 mod_auth_basic.so 模块需要解析符号ap_expr_str_exec,但未找到它。

您可以使用 readelf 命令的输出来验证这一点:

$ 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 二进制文件。

相关内容