GeoIP overview

GeoIP refers to the method of locating a computer’s geographic location by identifying its IP address or hostname. DreamHost currently provides GeoIP as a Ruby 'Gem' and a Perl module.

Accessing the Perl module

To access the GeoIP Perl module, enter the following at your shell prompt:

[server]$ geoip-lookup [-l] <ipaddress|hostname>

For example:

[server]$ geoip-lookup -l
United States

Accessing the Perl module from PHP

The following shows you an example of how to access the Perl module using the shell_exec command in PHP:

$output = shell_exec('geoip-lookup '.$_SERVER['REMOTE_ADDR']);
  • The code above outputs the country’s abbreviated name.

Custom install

If you’re on a VPS or Dedicated server, you can install your own custom version.

For more information (including download instructions for custom GeoIP files), please visit the following page:

See also

Did this article answer your questions?

Article last updated .