logo
Apache Lounge
Webmasters

 


About

Forum Index Downloads Search Register Log in  RSS Apache Lounge
 



Keep Server Online

If you find the Apache Lounge, the downloads and overall help useful, please express your satisfaction with a donation.

or

Bitcoin

A donation makes a contribution towards the costs, the time and effort that's going in this site and building.

Thank You! Steffen

Apache Lounge is not sponsored.

Your donations will help to keep this site alive and well, and continuing building binaries.



Cannot load modules/mod_security2.so (Win32 2.4.17 VC14)

 
Post new topic   Reply to topic    Apache Forum Index -> Apache third-party Modules



View previous topic :: View next topic  
Author Message
RenardZorro



Joined: 25 Nov 2015
Posts: 8
Location: England, Cheltenham

PostPosted: Wed 25 Nov '15 20:38    Post subject: Cannot load modules/mod_security2.so (Win32 2.4.17 VC14) Reply with quote

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: 2581
Location: Hilversum, NL, EU

PostPosted: Wed 25 Nov '15 20:41    Post subject: Reply with quote

Did you copy yajl.dll and libcurl.dll to your apache/bin folder ? See the readme in the .zip and https://www.apachelounge.com/viewtopic.php?p=31194
Back to top
RenardZorro



Joined: 25 Nov 2015
Posts: 8
Location: England, Cheltenham

PostPosted: Wed 25 Nov '15 21:11    Post subject: Reply with quote

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

PostPosted: Wed 25 Nov '15 21:13    Post subject: Reply with quote

The readme in the .zip and https://www.apachelounge.com/viewtopic.php?p=31194 have been followed to the letter, as far as I can tell. I have rechecked several times.
Back to top
glsmith
Moderator


Joined: 16 Oct 2007
Posts: 2123
Location: Sun Diego, USA

PostPosted: Wed 25 Nov '15 21:24    Post subject: Reply with quote

From the command prompt, what is the output of
httpd -V
Back to top
RenardZorro



Joined: 25 Nov 2015
Posts: 8
Location: England, Cheltenham

PostPosted: Wed 25 Nov '15 21:31    Post subject: Reply with quote

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: 2581
Location: Hilversum, NL, EU

PostPosted: Wed 25 Nov '15 23:02    Post subject: Reply with quote

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

PostPosted: Thu 26 Nov '15 1:00    Post subject: Reply with quote

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: 2123
Location: Sun Diego, USA

PostPosted: Thu 26 Nov '15 3:36    Post subject: Reply with quote

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

PostPosted: Thu 26 Nov '15 10:02    Post subject: Reply with quote

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: 2581
Location: Hilversum, NL, EU

PostPosted: Thu 26 Nov '15 10:54    Post subject: Reply with quote

When you start httpd.exe, anything in the Windows Event Viewer ?
Back to top
RenardZorro



Joined: 25 Nov 2015
Posts: 8
Location: England, Cheltenham

PostPosted: Thu 26 Nov '15 11:10    Post subject: Reply with quote

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: 2581
Location: Hilversum, NL, EU

PostPosted: Thu 26 Nov '15 11:36    Post subject: Reply with quote

And what gives:

>httpd.exe -t
Back to top
Steffen
Moderator


Joined: 15 Oct 2005
Posts: 2581
Location: Hilversum, NL, EU

PostPosted: Thu 26 Nov '15 11:41    Post subject: Reply with quote

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

PostPosted: Thu 26 Nov '15 11:53    Post subject: Reply with quote

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

PostPosted: Thu 21 Sep '17 10:10    Post subject: Cannot load modules/mod_security2.so Reply with quote

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


Post new topic   Reply to topic    Apache Forum Index -> Apache third-party Modules
Page 1 of 1