無法載入 /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 二進位。

相關內容