Cannot load /etc/httpd/modules/mod_auth_basic.so

apache-2.2

After trying to upgrade apache 2.2.3 to 2.4.7 by compiling 2.4.7 from scratch. Im getting the following error,

[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]

However the file is there,

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

My original conf for 2.2.3 was in /etc/httpd and the commands I ran to compile were,

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

Any Ideas ?

Best Answer

ap_expr_str_exec is an API function that was newly introduced in the Apache httpd 2.4 core. The error is your runtime linker complaining that the mod_auth_basic.so module needs to resolve the ap_expr_str_exec symbol, but that it wasn't found.

You can verify this with the output of the readelf command:

$ 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
   ...

The UND value for the symbol index means that it is undefined and therefore must be resolved at runtime.

So, since your module is referencing a 2.4 symbol but your running executable doesn't have it, it looks like trying to load an httpd 2.4 module into an httpd 2.2 instance. Make sure you're definitely running the correct httpd binary.

Related Topic