title: Undefined symbol when loading Apache2 mod_xml2enc
body: <p>I am so frustrated installing reverse-proxy-related modules to Apache2 HTTP server on a CentOS 5 box. Since it's an old version of Apache2 server, I had to compile the modules from source using Apache tool 'apxs'. I got no warnings or errors installing the module by 'apxs' but got runtime error when trying to restart the Apache server.</p>
  
  <pre><code>Starting httpd: httpd: Syntax error on line 206 of /etc/httpd/conf/httpd.conf: Cannot load /usr/lib64/httpd/modules/mod_xml2enc.so into server: /usr/lib64/httpd/modules/mod_xml2enc.so: undefined symbol: xmlDetectCharEncoding
                                                             [FAILED]
  </code></pre>
  
  <p>The following are more details.</p>
  
  <pre><code>OS:  CentOS 5.11; Linux 2.6.18-400.1.1.el5 #1 SMP Thu Dec 18 00:59:53 EST 2014 x86_64 x86_64 x86_64 GNU/Linux
  Apache: version 2.2.3
  </code></pre>
  
  <p>For historical reason, I cannot upgrade either of them to newer version to fix the issue.</p>
  
  <p>The OS was originally lack of libxml2, which I installed by yum successfully with no issue. I downloaded the source files of mod_proxy_html including 1) mod_xml2enc.c, 2) mod_proxy_html.h  and 3) mod_proxy_html.c</p>
  
  <p>I used the following commands to at first install mod_xml2enc and then mod_proxy_html.</p>
  
  <pre><code>apxs -i -a -c -I /usr/include/libxml2/ mod_xml2enc.c
  apxs -i -a -c -I /usr/include/libxml2/ -I ./ mod_proxy_html.c
  </code></pre>
  
  <p>Both seemed OK and showed some output like the following:</p>
  
  <pre><code>/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -fno-strict-aliasing  -DLINUX=2 -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1  -I/usr/include/libxml2/  -c -o mod_xml2enc.lo mod_xml2enc.c &amp;&amp; touch mod_xml2enc.slo
  /usr/lib64/apr-1/build/libtool --silent --mode=link gcc -o mod_xml2enc.la  -rpath /usr/lib64/httpd/modules -module -avoid-version    mod_xml2enc.lo
  /usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_xml2enc.la /usr/lib64/httpd/modules
  /usr/lib64/apr-1/build/libtool --mode=install cp mod_xml2enc.la /usr/lib64/httpd/modules/
  cp .libs/mod_xml2enc.so /usr/lib64/httpd/modules/mod_xml2enc.so
  cp .libs/mod_xml2enc.lai /usr/lib64/httpd/modules/mod_xml2enc.la
  cp .libs/mod_xml2enc.a /usr/lib64/httpd/modules/mod_xml2enc.a
  chmod 644 /usr/lib64/httpd/modules/mod_xml2enc.a
  ranlib /usr/lib64/httpd/modules/mod_xml2enc.a
  PATH="$PATH:/sbin" ldconfig -n /usr/lib64/httpd/modules
  ----------------------------------------------------------------------
  Libraries have been installed in:
     /usr/lib64/httpd/modules
  
  If you ever happen to want to link against installed libraries
  in a given directory, LIBDIR, you must either use libtool, and
  specify the full pathname of the library, or use the `-LLIBDIR'
  flag during linking and do at least one of the following:
     - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
       during execution
     - add LIBDIR to the `LD_RUN_PATH' environment variable
       during linking
     - use the `-Wl,--rpath -Wl,LIBDIR' linker flag
     - have your system administrator add LIBDIR to `/etc/ld.so.conf'
  
  See any operating system documentation about shared libraries for
  more information, such as the ld(1) and ld.so(8) manual pages.
  ----------------------------------------------------------------------
  chmod 755 /usr/lib64/httpd/modules/mod_xml2enc.so
  [activating module `xml2enc' in /etc/httpd/conf/httpd.conf]
  </code></pre>
  
  <p>However, when I tried to restart the server, the error message I put at the top was raised.</p>
  
  <p>I've tried many ways to fix this issue, however, nothing worked. Maybe it's worth noting that I took the exact steps installing the same modules on a CentOS 5.11 32bit machine and got no problem at all. The only difference between these two machines is just one is 32-bit and the other is 64-bit.</p>
  
  <p>Hope someone would know how to fix this issue.</p>
  
  <p>Thanks a lot in advance.</p>