In the examples shown, replace "5.X" with your app's PHP version (for example, "5.4"). To install a PECL extension for multiple PHP versions, repeat the PECL extension installation for each PHP version.

GeoIP

The GeoIP extension allows you to find the location of an IP address, including the city, state, country, latitude, and longitude.

If you'd like to use the new GeoIP2, MaxMind now offers a pure PHP implementation that doesn't require a C extension: https://github.com/maxmind/GeoIP2-php.

To install this extension, run the following command as your server's root user:

sudo apt-get install gcc make autoconf libc-dev pkg-config
sudo apt-get install libgeoip-dev
sudo pecl5.X-sp install geoip

Once installed, create a configuration file for the extension and restart PHP by running the following command as root

sudo bash -c "echo extension=geoip.so > /etc/php5.X-sp/conf.d/geoip.ini"
sudo service php5.X-fpm-sp restart

You can check that it was installed with the command:

php5.X-sp -i | grep geoip

The output will look like this:

$ php5.5-sp -i | grep geoip
/etc/php5.5-sp/conf.d/geoip.ini,
geoip
geoip support => enabled
geoip extension version => 1.0.8
geoip library version => 1004008
geoip.custom_directory => no value => no value

Installing GeoIP on PHP 7.0

The GeoIP extension does not currently work with PHP 7.0. If you attempt to install it on PHP 7.0, you will encounter errors building the extension. As soon as the extension is updated to work with PHP 7.0, you will be able to install it.

Alert: For Control Panel Help & Tutorials, click here: Panel Tutorials
Was this answer helpful? 0 Users Found This Useful (0 Votes)

Powered by WHMCompleteSolution