Keep Server Online
  
If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.
  
or
  
 
  
A donation makes a contribution towards the costs, the time and effort that's going in this site and building.
  
Thank You! Steffen
  
Your donations will help to keep this site alive and well, and continuing building binaries. Apache Lounge is not sponsored.
 |    |   
 | 
     Topic: Cannot load modules/mod_security2.so | 
Page 1, 2  Next |   
| Author | 
  | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 Posted: Wed 25 Nov '15 20:38    Post subject: Cannot load modules/mod_security2.so | 
     | 
 
  | 
 
I have successfully installed latest build of Apache for Win32 running with PHP on my local development server (localhost) (Win32 2.4.17 VC14) (Source: Apache Lounge). This runs happily with the .conf files I have set up and also with the PHP applications under development.
 
 
However, it doesn't run with the - apparently - correct version of mod_security.
 
 
When I try to run & install the mod_security-2.9.0-win32-VC14 and/or the mod_evasive2-1.10.2-win32-VC14 (also both from Apache Lounge), then the httpd will not run and if I try to install Apache as a service, the installer reports:
 
 	  | Code: | 	 		  | httpd: Syntax error on line 120 of httpd.conf: Cannot load modules/mod_security2.so into server: The specified module could not be found. | 	  
 
However, the module is in the modules directory along with all other active modules, which all load correctly and cause no issue.
 
 
If the module:
 
 	  | Code: | 	 		  | LoadModule security2_module modules/mod_security2.so | 	  
 
is commented out in the .conf file with a '#', then the webserver loads and runs without issue.
 
 
I also have the following installed and running without issue and as recommended:
 
 	  | Code: | 	 		  | LoadModule unique_id_module modules/mod_unique_id.so | 	  
 
As both webserver and module are compiled under the same compiler version and both come from the same source (Apache Lounge) does anyone know why this doesn't work?
  Last edited by RenardZorro on Wed 25 Nov '15 21:09; edited 1 time in total | 
 
  | 
 
| Back to top | 
 | 
 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 | 
 
| Back to top | 
 | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 Posted: Wed 25 Nov '15 21:11    Post subject:  | 
     | 
 
  | 
 
| both yajl.dll and libcurl.dll have been copied into the \bin directory | 
 
  | 
 
| Back to top | 
 | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 | 
 
| Back to top | 
 | 
 
glsmith Moderator
  
  Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
  | 
 Posted: Wed 25 Nov '15 21:24    Post subject:  | 
     | 
 
  | 
 
From the command prompt, what is the output of
 
httpd -V | 
 
  | 
 
| Back to top | 
 | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 Posted: Wed 25 Nov '15 21:31    Post subject:  | 
     | 
 
  | 
 
Server version: Apache/2.4.17 (Win32)
 
Apache Lounge VC14 Server built:   Oct 11 2015 16:06:02
 
Server's Module Magic Number: 20120211:51
 
Server loaded:  APR 1.5.2, APR-UTIL 1.5.4
 
Compiled using: APR 1.5.2, APR-UTIL 1.5.4
 
Architecture:   32-bit
 
Server MPM:     WinNT
 
  threaded:     yes (fixed thread count)
 
    forked:     no
 
Server compiled with....
 
 -D APR_HAS_SENDFILE
 
 -D APR_HAS_MMAP
 
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 
 -D APR_HAS_OTHER_CHILD
 
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 
 -D DYNAMIC_MODULE_LIMIT=256
 
 -D HTTPD_ROOT="/apache"
 
 -D SUEXEC_BIN="/apache/bin/suexec"
 
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 
 -D DEFAULT_ERRORLOG="logs/error.log"
 
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 
 -D SERVER_CONFIG_FILE="conf/httpd.conf" | 
 
  | 
 
| Back to top | 
 | 
 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Wed 25 Nov '15 23:02    Post subject:  | 
     | 
 
  | 
 
Absolutely sure downloaded module is also Win32 ?
 
 
For Win32, in the .zip is a file -- Build with VC14 x86 -- | 
 
  | 
 
| Back to top | 
 | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 Posted: Thu 26 Nov '15 1:00    Post subject:  | 
     | 
 
  | 
 
Thanks for reply.
 
 
Absolutely certain.
 
 
This copied from ZIP file next to *.dll files:  
 
 
-- Build with VC14 x86 --
 
 
To be certain, I again copied the files from this ZIP directly into the Apache folders.
 
 
This is code within http.conf:
 
 
 	  | Code: | 	 		  #-------------------------------------------------------------------------
 
# Add-in module from Apache Lounge for additional features
 
#-------------------------------------------------------------------------
 
LoadModule unique_id_module modules/mod_unique_id.so
 
LoadModule security2_module modules/mod_security2.so
 
 
<IfModule security2_module>
 
 
   # Disguise  server signature
 
   #-----------------------
 
   SecRuleEngine DetectionOnly
 
   #ServerSignature Off
 
   #ServerTokens Full
 
   #SecServerSignature "Microsoft-IIS/6.0"
 
   
 
</IfModule> | 	  
 
 
Only works if I comment out the security2_module. | 
 
  | 
 
| Back to top | 
 | 
 
glsmith Moderator
  
  Joined: 16 Oct 2007 Posts: 2268 Location: Sun Diego, USA
  | 
 Posted: Thu 26 Nov '15 3:36    Post subject:  | 
     | 
 
  | 
 
Strange and I cannot duplicate
 
Clean machine, your config snippet with fresh downloads of:
 
httpd-2.4.17-win32-VC14.zip
 
mod_evasive2-1.10.2-win32-VC14.zip
 
mod_security-2.9.0-win32-VC14.zip
 
 
https://www.apachehaus.net/temp/al2417modsec290.png
 
you can see both mod_security2 (bottom second from left) and mod_evasive2 (right above mod_security) showing as loaded modules.
 
 
I have been through this before myself and it was something really simple that I just could not see cause my eyes were not fresh enough.
 
 
I'm curious, from the command prompt again, what is the output of:
 
dir *.dll | 
 
  | 
 
| Back to top | 
 | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 Posted: Thu 26 Nov '15 10:02    Post subject:  | 
     | 
 
  | 
 
Directory of D:\PROGRAMS\Apache2.4.17\bin
 
 
25/11/2015  10:31            15,872 apr_crypto_openssl-1.dll
 
25/11/2015  10:31            24,064 apr_dbd_odbc-1.dll
 
25/11/2015  10:31            12,800 apr_ldap-1.dll
 
25/11/2015  10:31           155,136 libapr-1.dll
 
25/11/2015  10:31            29,184 libapriconv-1.dll
 
25/11/2015  10:31           208,896 libaprutil-1.dll
 
25/11/2015  22:57           290,816 libcurl.dll
 
25/11/2015  10:31         1,264,640 libeay32.dll
 
25/11/2015  10:31           343,040 libhttpd.dll
 
25/11/2015  10:31         1,032,192 libxml2.dll
 
25/11/2015  10:31           132,608 lua51.dll
 
25/11/2015  10:31           128,000 nghttp2.dll
 
25/11/2015  10:31           409,600 pcre.dll
 
25/11/2015  10:31           297,472 ssleay32.dll
 
25/11/2015  22:57           320,512 yajl.dll
 
25/11/2015  10:31            71,680 zlib1.dll
 
              16 File(s)      4,736,512 bytes
 
 
and modules:
 
 
Directory of D:\PROGRAMS\Apache2.4.17\modules
 
 
25/11/2015  10:31            13,824 mod_access_compat.so
 
25/11/2015  10:31            12,288 mod_actions.so
 
25/11/2015  10:31            15,872 mod_alias.so
 
25/11/2015  10:31            11,776 mod_allowmethods.so
 
25/11/2015  10:31            11,776 mod_asis.so
 
25/11/2015  10:31            25,088 mod_authnz_fcgi.so
 
25/11/2015  10:31            37,376 mod_authnz_ldap.so
 
25/11/2015  10:31            11,776 mod_authn_anon.so
 
25/11/2015  10:31            13,312 mod_authn_core.so
 
25/11/2015  10:31            14,336 mod_authn_dbd.so
 
25/11/2015  10:31            11,776 mod_authn_dbm.so
 
25/11/2015  10:31            12,288 mod_authn_file.so
 
25/11/2015  10:31            16,384 mod_authn_socache.so
 
25/11/2015  10:31            19,968 mod_authz_core.so
 
25/11/2015  10:31            15,360 mod_authz_dbd.so
 
25/11/2015  10:31            13,824 mod_authz_dbm.so
 
25/11/2015  10:31            14,336 mod_authz_groupfile.so
 
25/11/2015  10:31            12,800 mod_authz_host.so
 
25/11/2015  10:31            12,800 mod_authz_owner.so
 
25/11/2015  10:31            11,776 mod_authz_user.so
 
25/11/2015  10:31            16,384 mod_auth_basic.so
 
25/11/2015  10:31            30,720 mod_auth_digest.so
 
25/11/2015  10:31            24,576 mod_auth_form.so
 
25/11/2015  10:31            31,232 mod_autoindex.so
 
25/11/2015  10:31            12,800 mod_buffer.so
 
25/11/2015  10:31            49,152 mod_cache.so
 
25/11/2015  10:31            26,112 mod_cache_disk.so
 
25/11/2015  10:31            27,136 mod_cache_socache.so
 
25/11/2015  10:31            13,312 mod_cern_meta.so
 
25/11/2015  10:31            22,528 mod_cgi.so
 
25/11/2015  10:31            18,944 mod_charset_lite.so
 
25/11/2015  10:31            12,288 mod_data.so
 
25/11/2015  10:31            76,800 mod_dav.so
 
25/11/2015  10:31            38,912 mod_dav_fs.so
 
25/11/2015  10:31            18,432 mod_dav_lock.so
 
25/11/2015  10:31            18,944 mod_dbd.so
 
25/11/2015  10:31            27,648 mod_deflate.so
 
25/11/2015  10:31            14,336 mod_dir.so
 
25/11/2015  10:31            12,800 mod_dumpio.so
 
25/11/2015  10:31            11,776 mod_env.so
 
25/11/2015  19:36            13,312 mod_evasive2.so
 
25/11/2015  10:31            14,848 mod_expires.so
 
25/11/2015  10:31            19,968 mod_ext_filter.so
 
25/11/2015  10:31            13,824 mod_file_cache.so
 
25/11/2015  10:31            17,408 mod_filter.so
 
25/11/2015  10:31            19,456 mod_headers.so
 
25/11/2015  10:31            12,800 mod_heartbeat.so
 
25/11/2015  10:31            21,504 mod_heartmonitor.so
 
25/11/2015  10:31            74,240 mod_http2.so
 
25/11/2015  10:31            12,800 mod_ident.so
 
25/11/2015  10:31            18,432 mod_imagemap.so
 
25/11/2015  10:31            40,960 mod_include.so
 
25/11/2015  10:31            24,576 mod_info.so
 
25/11/2015  10:31            26,112 mod_isapi.so
 
25/11/2015  10:31            11,776 mod_lbmethod_bybusyness.so
 
25/11/2015  10:31            11,776 mod_lbmethod_byrequests.so
 
25/11/2015  10:31            12,288 mod_lbmethod_bytraffic.so
 
25/11/2015  10:31            15,872 mod_lbmethod_heartbeat.so
 
25/11/2015  10:31            54,272 mod_ldap.so
 
25/11/2015  10:31            12,800 mod_logio.so
 
25/11/2015  10:31            26,624 mod_log_config.so
 
25/11/2015  10:31            14,336 mod_log_debug.so
 
25/11/2015  10:31            13,312 mod_log_forensic.so
 
25/11/2015  10:31            78,848 mod_lua.so
 
25/11/2015  10:31            18,432 mod_macro.so
 
25/11/2015  10:31            18,944 mod_mime.so
 
25/11/2015  10:31            24,576 mod_mime_magic.so
 
25/11/2015  10:31            31,232 mod_negotiation.so
 
25/11/2015  10:31            79,872 mod_proxy.so
 
25/11/2015  10:31            35,840 mod_proxy_ajp.so
 
25/11/2015  10:31            38,912 mod_proxy_balancer.so
 
25/11/2015  10:31            16,896 mod_proxy_connect.so
 
25/11/2015  10:31            12,800 mod_proxy_express.so
 
25/11/2015  10:31            19,968 mod_proxy_fcgi.so
 
25/11/2015  10:31            31,744 mod_proxy_ftp.so
 
25/11/2015  10:31            25,600 mod_proxy_html.so
 
25/11/2015  10:31            30,720 mod_proxy_http.so
 
25/11/2015  10:31            17,408 mod_proxy_scgi.so
 
25/11/2015  10:31            15,872 mod_proxy_wstunnel.so
 
25/11/2015  10:31            13,312 mod_ratelimit.so
 
25/11/2015  10:31            12,800 mod_reflector.so
 
25/11/2015  10:31            15,360 mod_remoteip.so
 
25/11/2015  10:31            15,872 mod_reqtimeout.so
 
25/11/2015  10:31            13,824 mod_request.so
 
25/11/2015  10:31            54,784 mod_rewrite.so
 
25/11/2015  22:57           621,568 mod_security2.so
 
25/11/2015  10:31            31,744 mod_sed.so
 
25/11/2015  10:31            17,920 mod_session.so
 
25/11/2015  10:31            12,800 mod_session_cookie.so
 
25/11/2015  10:31            18,944 mod_session_crypto.so
 
25/11/2015  10:31            17,408 mod_session_dbd.so
 
25/11/2015  10:31            15,360 mod_setenvif.so
 
25/11/2015  10:31            11,776 mod_slotmem_plain.so
 
25/11/2015  10:31            17,408 mod_slotmem_shm.so
 
25/11/2015  10:31            15,872 mod_socache_dbm.so
 
25/11/2015  10:31            13,824 mod_socache_memcache.so
 
25/11/2015  10:31            22,528 mod_socache_shmcb.so
 
25/11/2015  10:31            14,848 mod_speling.so
 
25/11/2015  10:31           133,120 mod_ssl.so
 
25/11/2015  10:31            24,064 mod_status.so
 
25/11/2015  10:31            15,872 mod_substitute.so
 
25/11/2015  10:31            13,312 mod_unique_id.so
 
25/11/2015  10:31            12,800 mod_userdir.so
 
25/11/2015  10:31            15,360 mod_usertrack.so
 
25/11/2015  10:31            12,288 mod_version.so
 
25/11/2015  10:31            13,824 mod_vhost_alias.so
 
25/11/2015  10:31            17,408 mod_watchdog.so
 
25/11/2015  10:31            18,944 mod_xml2enc.so
 
             108 File(s)      3,049,472 bytes | 
 
  | 
 
| Back to top | 
 | 
 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Thu 26 Nov '15 10:54    Post subject:  | 
     | 
 
  | 
 
| When you start httpd.exe, anything in the Windows Event Viewer ? | 
 
  | 
 
| Back to top | 
 | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 Posted: Thu 26 Nov '15 11:10    Post subject:  | 
     | 
 
  | 
 
Not that I can see.
 
 
Does mod_security or any of the *.dll's rely upon any specific Services under the Windows version?
 
 
I'm running Windows 7 Pro Service pack 1. | 
 
  | 
 
| Back to top | 
 | 
 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Thu 26 Nov '15 11:36    Post subject:  | 
     | 
 
  | 
 
And what gives:
 
 
>httpd.exe -t | 
 
  | 
 
| Back to top | 
 | 
 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Thu 26 Nov '15 11:41    Post subject:  | 
     | 
 
  | 
 
 	  | RenardZorro wrote: | 	 		  | Does mod_security or any of the *.dll's rely upon any specific Services under the Windows version? | 	  
 
 
Is there a yajl.dll and/or libcurl.dll in Windows, Windows/System32, SysWow64 or in a folder of your windows Path ?
 
 
>set
 
 
And see under PATH= | 
 
  | 
 
| Back to top | 
 | 
 
RenardZorro
 
 
  Joined: 25 Nov 2015 Posts: 8 Location: England, Cheltenham
  | 
 Posted: Thu 26 Nov '15 11:53    Post subject:  | 
     | 
 
  | 
 
The command:
 
 
httpd.exe -t
 
 
uncovered the issue. The ServerRoot directory was set incorrectly. So, while all the php and virtual hosts were correct, the ServerRoot was pointing in the wrong place. 
 
 
Stupid.
 
 
Everything now appears to be working correctly and at least I've had the opportunity to go through the .conf files in detail.
 
 
Many thanks for your excellent help on this, it is much appreciated.
 
 
Simon | 
 
  | 
 
| Back to top | 
 | 
 
mije
 
 
  Joined: 21 Sep 2017 Posts: 1 Location: Vietnam
  | 
 Posted: Thu 21 Sep '17 10:10    Post subject: Cannot load modules/mod_security2.so | 
     | 
 
  | 
 
| Same thing happened to me. My solution was to make sure the C++ Redistributable Visual Studio 2017 is correctly installed. If your webserver is Win32(x86), so be sure to use x86 C++ compiler. Hope this help. | 
 
  | 
 
| Back to top | 
 | 
 
JackieChan5588
 
 
  Joined: 14 May 2018 Posts: 5
 
  | 
 Posted: Tue 15 May '18 17:29    Post subject: mod_security_2.so not loaded after verifying all suggestions | 
     | 
 
  | 
 
Windows Server 2012 SP2 (64-bit).
 
Apache 2.4.33 (64-bit) installed to "D:\Apache24"
 
Apache and mod_security2 x64 downloaded from the 
 
same latest apachelounge.com page.
 
Visual C++ Redist 2017 x64 installed.
 
Also tried it with earlier version of Visual C++ x64.
 
--
 
Hi there.  
 
Apache 2.4.33 x64 starts without mod_security2.so.
 
Adding LoadModule for mod_security2.so and 
 
mod_unique_id.so fails with syntax error.
 
Applied and reviewed all suggestions in this thread.
 
Q: Would the build using HTTPD_ROOT "/apache" cause a 
 
   problem for loading mod_security2.so ?
 
Q: Running a dependency anaylzer tool on mod_security2
 
reveals  KERNEL32.DLL and WS2_32.DLL 32-bit files despite
 
that I acquired the 64-bit mod_security2 from the Apache
 
2.4.33 64-bit page.
 
--
 
httpd -V yields:
 
D:\Apache24\bin>httpd -V
 
Server version: Apache/2.4.33 (Win64)
 
Apache Lounge VC15 Server built:   Mar 28 2018 12:38:12
 
Server's Module Magic Number: 20120211:76
 
Server loaded:  APR 1.6.3, APR-UTIL 1.6.1
 
Compiled using: APR 1.6.3, APR-UTIL 1.6.1
 
Architecture:   64-bit
 
Server MPM:     WinNT
 
  threaded:     yes (fixed thread count)
 
    forked:     no
 
Server compiled with....
 
 -D APR_HAS_SENDFILE
 
 -D APR_HAS_MMAP
 
 -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled)
 
 -D APR_HAS_OTHER_CHILD
 
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 
 -D DYNAMIC_MODULE_LIMIT=256
 
 -D HTTPD_ROOT="/apache"
 
 -D SUEXEC_BIN="/apache/bin/suexec"
 
 -D DEFAULT_PIDLOG="logs/httpd.pid"
 
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 
 -D DEFAULT_ERRORLOG="logs/error.log"
 
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 
 -D SERVER_CONFIG_FILE="conf/httpd.conf"
 
 
Thank you. | 
 
  | 
 
| Back to top | 
 | 
 
JackieChan5588
 
 
  Joined: 14 May 2018 Posts: 5
 
  | 
 Posted: Tue 15 May '18 18:06    Post subject: mod_security2.so gives : procedure could not be found | 
     | 
 
  | 
 
Addendum to previous issue:
 
D:\Apache24\bin>httpd -t
 
httpd: Syntax error on line 207 of D:/Apache24/conf/httpd.conf: Cannot load modules/mod_security2.so into server: 
 
The specified procedure could not be found. | 
 
  | 
 
| Back to top | 
 | 
 
Steffen Moderator
 
  Joined: 15 Oct 2005 Posts: 3131 Location: Hilversum, NL, EU
  | 
 Posted: Tue 15 May '18 18:20    Post subject:  | 
     | 
 
  | 
 
Running here Win64.
 
 
Be sure you downloaded the Win64 VC15 mod_security.
 
 
be sure ServerRoot "D:/apache24"
 
 
And follow exactly the readme:
 
 
Copy mod_security2.so to your D:/apache24/apache/modules folder
 
 
Copy yajl.dll and libcurl.dll to your D:/apache24/apache/bin folder
 
 
And you must have:
 
 
LoadModule security2_module modules/mod_security2.so
 
LoadModule unique_id_module modules/mod_unique_id.so | 
 
  | 
 
| Back to top | 
 | 
 
JackieChan5588
 
 
  Joined: 14 May 2018 Posts: 5
 
  | 
 Posted: Tue 15 May '18 19:04    Post subject: Verified mod_security requirements | 
     | 
 
  | 
 
Verified mod_security requirements as requested.
 
All downloads from:
 
https://www.apachelounge.com/download/.
 
I have your libcurl.dll and yajl.dll in both 
 
\bin and \modules.
 
--
 
I noticed that your build already includes libxml2.dll,
 
so  perhaps libxml2 from your build is conflicting
 
with a preexisting libxml2.dll.
 
--
 
A global Windows Explorer search on all these DLL files
 
in the Windows set PATH shows that Trend Micro Scan
 
references libcurl.dll in folder:
 
C:\Program Files (x86)\Trend Micro\Client Server Security Agent\CCSF\module\scan\ .  I will try to turn off Trend Micro as well as do a global search in the machine for
 
any matching DLLs used by mod_security2.
 
--
 
Am using in Windows D:\Apache24, not D:/Apache24 path.
 
Can Windows Server SmartSecurity feature prevent 
 
LoadModule? | 
 
  | 
 
| Back to top | 
 | 
 
 
 
 
 | 
 
 
 |  
 
 |  
  |   
 |