Ivan Tomica

Enable GeoIP on PHP 7.0 on FreeBSD

Since pecl extension is compiled against PHP 5.6 in official FreeBSD repositories you’ll need to manually compile this PECL extension to have it included in PHP 7.0. Luckily for you process is really simple.

Install autoconf so PHP can detect variables:

pkg install autoconf

Download latest PECL extension version from PHP’s website:

fetch https://pecl.php.net/get/geoip-1.1.1.tgz

Extract and configure it:

tar -xzvf geoip-1.1.1.tgz
cd geoip-1.1.1/

Finally, compile and install:

make install

To have it loaded by your PHP-FPM (assuming you’re using it) include it in your php.ini configuration. I did it by creating /usr/local/etc/php/ext-99-geoip.ini file with following contents:


As extension is in PHP’s library PATH by default.

Tagged in:,
Sysadmin on the everlasting journey of learning.


  1. Daniel

    2017-04-21 - 14:21

    GeoIP is deprecated. Use  GeoIP2.

    • Ivan Tomica

      2017-04-21 - 14:49

      Thank you. Will keep that in mind for future needs.

Leave a Reply

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