Using PHP GeoIP

Enabling GeoIP

By default, the PHP GeoIP extension is disabled on MageStack (to prevent conflicts if you are using class-based GeoIP libraries). We can enable this on a server-by-server basis, so contact the support team to enable GeoIP.

Using native GeoIP

MageStack offers native GeoIP functionality so that you do not need to load additional libraries and add the overhead of further GeoIP look-ups. This information is accessible via the $_SERVER variable. Learn more about pre-defined server variables.

Included databases

We include the standard free GeoIP databases,

  • GeoIP.dat
  • GeoIPv6.dat

But it can also be supplemented with the "paid for" city databases. In order to do so, you must create the lib/GeoIP folder in your Magento document root, and place your .dat files inside of it.

Eg.

/microcloud/domains/example/domains/example.com/http/lib/GeoIP

After you have put these files in place, contact the support team to re-build your domain group, at which time, a symlink will be created for the PHP install to utilise your personal GeoIP database file(s).

You can then update your database as frequently as you wish, by merely updating the .dat files in your lib/GeoIP directory.