Location, Location, Location

We’ve been setting up a new web site so now is a chance to update blocking those pesky hackers from Russia and China. Not that there aren’t pesky hackers in the US and EU too but we don’t do business in Russia or China so these can be blocked outright.

Iran, too, come to that.

Extension DLL

Our site uses PHP on Windows 2008 Server and there’s an extension for finding out the country from an IP address. It’s PECL DLL called php_geoip.dll.

Like all extensions it belongs in the extensions directory (defined in php.ini) and then an extension entry needs to be added to php.ini to activate it. We we discovered that it’s really important that the dll used is compiled just the way your PHP is. In our case its PHP 5.3.6, x86, non-thread safe and compiled using VC9.

The install guide points to this location – just make sure you pick the build with the characteristics you need:


The extension uses a .dat file which contains the link between ip address and country/city/etc.. This page points to several files that can be used. MaxMind also have a subscription service which is updated weekly.

Every post about installing the extension on Linux covers where to put the this .dat file but none of the posts about installing the extension seem to touch on it. So let’s fix that oversight: put the .dat file in your PHP folder.

Information and Links

Join the fray by commenting, tracking what others have to say, or linking to it from your blog.

Other Posts

Reader Comments

Sorry, comments are closed.