How to install PHP GeoIP in Ubuntu

This instructions will install GeoIP over Ubuntu. It is tested over Ubuntu 12.04 LTS.

I assume you already have PEAR/PECL available. I am using the CentOS’s stock PHP. First you need to update your channels:

If you get an error like the following:

You might not have correctly installed geoip. Learn how to install and automate GeoIP updates on Linux.

After installing that, you should be able to successfully complete the PHP GeoIP installation:

Finally, you can add “” to your PHP’s configuration.

I also added the following settings in /etc/php5/conf.d/geoip.ini:

And finally to restart Apache:

This should work for Debian too.

2 thoughts on “How to install PHP GeoIP in Ubuntu”

  1. The code shortcode of your WordPress blog is broken. You have [code lang=”bash”] in your posts.

    Just wanted to tell you about this. No need to publish the comment.

Leave a Reply

Your email address will not be published. Required fields are marked *