Mar 08 2008

mod_geoip2

Published by blake

3.3 mod_geoip2

mod_geoip2 is the module that allows Apache to gather GeoIP data. You'll need GeoIP installed to use mod_geoip2.

Use your web browser to check out http://www.maxmind.com/download/geoip/api/mod_geoip2/ and find the latest version number. Copy the link so you can paste it into wget.

  • cd /usr/src/geoip
  • wget http://www.maxmind.com/download/geoip/api/mod_geoip2/mod_geoip2_[version]
  • tar zxvf mod_geoip2_[version]
  • cd mod_geoip2_[version]
  • /usr/sbin/apxs -i -a -L/usr/local/lib -I/usr/local/include -lGeoIP -c mod_geoip.c

Done! apxs automatically enables it in the Apache config file for us (although we already did that above). If you run the following command you should see geoip_module listed in the module list.

  • /usr/sbin/httpd -M

Once we get PHP installed, you can use the following test script (inside a web page, this won't work from the command line) to see the GeoIP data in the $_SERVER global variable.


<?php
print_r($_SERVER);
?>

  • Digg
  • del.icio.us
  • description
  • Slashdot
  • StumbleUpon

Trackback URI | Comments RSS

Leave a Reply