FreeBSD: Cannot load /usr/local/libexec/apache22/mod_security2.so into server: /usr/local/libexec/apache22/mod_security2.so

Q. I’ve installed Apache2 and mod_security21 under FreeBSD. Whenever I try to restart apach22 process I get following error:

ADVERTISEMENTS

Performing sanity check on apache22 configuration:
httpd: Syntax error on line 106 of /usr/local/etc/apache22/httpd.conf: Cannot load /usr/local/libexec/apache22/mod_security2.so into server: /usr/local/libexec/apache22/mod_security2.so: Undefined symbol “xmlFree”

How do I fix this problem?

A. First make sure you are running updated version for both Apache and mod_security. Next open your httpd.conf file:
vi /usr/local/etc/apache22/httpd.conf
Find line that read as follows:

LoadModule security2_module   libexec/apache22/mod_security2.so

Add line before above directive, so that it should look like as follows:

LoadFile /usr/local/lib/libxml2.so
LoadModule security2_module   libexec/apache22/mod_security2.so

Save and close the file. Restart apache:
# /usr/local/etc/rc.d/apache22 restart

🐧 Get the latest tutorials on SysAdmin, Linux/Unix, Open Source/DevOps topics:
CategoryList of Unix and Linux commands
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network Utilitiesdig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNCentOS 8 Debian 10 Firewall Ubuntu 20.04

ADVERTISEMENTS
3 comments… add one
  • z Sep 18, 2008 @ 15:45

    It would be useful if you explained what the problem is, and how you arrived at the solution.

  • 🐧 nixCraft Sep 18, 2008 @ 20:26

    a) Error itself indicated that it can not load xmlFree, which is part of libxml (used by many open source apps). So I needed to load libxml before mod_security. This is well known problem with apache.

    b) Run strings command on mod_security2.so to get idea about functions and other sutff

    c) Track syscall by running ktrace

    d) Experience

    HTH

  • z Sep 19, 2008 @ 22:40

    Thanks.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre>, <code>...</code> and <kbd>...</kbd> for code samples.