Internal Server Error 500 + mod_GeoIP Custom Module after install with EasyApache

jameshurrell

Member
Feb 17, 2011
11
1
53
Hello,

I have cPanel and WHM on CENTOS and need to use the Maxmind GeoIP tool to redirect incoming users based on their IP address.

I found that cPanel offer a Custom Module and so I used these instructions to download and install mod_GeoIP and then rebuild Apache with the mod_GeoIP module included:

Installing Free mod_GeoIP for Apache 2.x / Cpanel / CentOS | GNU Tool Box

This went well, managed to download and install the module using Putty, then recompiled Apache using EasyApache. All seemed fine.

I then downloaded the "lite" Country database from:

Index of /download/geoip/database/GeoLiteCountry

I placed it in /usr/local/share/GeoIP.dat (which is apparently the default location).

However, now when I use "GeoIPEnable On" in my .htaccess file, I get an "Internal Server Error 500". If I add the same line to the "pre_virtualhost_global.conf" file, and then try to restart Apache, the restart fails.

Edit: Using a phpinfo() file, I can see that the module is not listed - this is obviously the cause of the issue... so how do i go about enabling it?

Does anyone know what I am doing wrong?

Many thanks.
 
Last edited:

jameshurrell

Member
Feb 17, 2011
11
1
53
Many thanks again. It appears it is not listed:

Code:
core.c
  mod_authn_file.c
  mod_authn_default.c
  mod_authz_host.c
  mod_authz_groupfile.c
  mod_authz_user.c
  mod_authz_default.c
  mod_auth_basic.c
  mod_include.c
  mod_filter.c
  mod_log_config.c
  mod_logio.c
  mod_env.c
  mod_expires.c
  mod_headers.c
  mod_unique_id.c
  mod_setenvif.c
  mod_version.c
  mod_proxy.c
  mod_proxy_connect.c
  mod_proxy_ftp.c
  mod_proxy_http.c
  mod_proxy_scgi.c
  mod_proxy_ajp.c
  mod_proxy_balancer.c
  mod_ssl.c
  prefork.c
  http_core.c
  mod_mime.c
  mod_status.c
  mod_autoindex.c
  mod_asis.c
  mod_info.c
  mod_suexec.c
  mod_cgi.c
  mod_negotiation.c
  mod_dir.c
  mod_actions.c
  mod_userdir.c
  mod_alias.c
  mod_rewrite.c
  mod_so.c
Thanks.
 

cPanelTristan

Quality Assurance Analyst
Staff member
Oct 2, 2010
7,607
43
348
somewhere over the rainbow
cPanel Access Level
Root Administrator
Hello,

You cannot tell if a module is or is not installed simply by running httpd -l to check for the list of modules, since some are shared modules and will not appear in httpd -l list (also httpd -l only works if using Apache 2.0 and 2.2 not Apache 1.3). The way to check this if the module might be shared is the following:

Code:
httpd -M | grep -i geoip

httpd -l | grep -i geoip
Here is a good example security2_module, which is a shared Apache module, not showing up under httpd -l and why this is necessary to use both to check it:

Code:
# httpd -l|grep -i security
#
# httpd -M|grep -i security
Syntax OK
 security2_module (shared)
Thanks.
 

jameshurrell

Member
Feb 17, 2011
11
1
53
Just to close this thread off - it is now working.

I managed to sort it out by adding the following lines to the pre_main_2.conf file via WHM:

Code:
LoadModule geoip_module /usr/local/apache/modules/mod_geoip.so
GeoIPEnable On
Then I restarted Apache.

Tristan: thank you, the code httpd -M showed: geoip_module (shared)