GeoIP (Installation Guide from cPInstall)
The GeoIP extension allows you to find the location of an IP address. City, State, Country, Longitude, Latitude, and other information as all, such as ISP and connection type can be obtained with the help of GeoIP.
For installing the said PHP extension as an APache module, You need to install the dependencies first.
Create a custom installation directory, from which you are going to install the mod_geoip2 package.
In the directory, download the latest Country and City database files from maxmind.
For installing mod_geoip2, the dependencies httpd-devel and apr-devel needed to be installed.
The httpd-devel package contains the APXS (Apache Extension Tool) binary and other files that you need to build Dynamic Shared Objects (DSOs) for the Apache HTTP Server. If you are installing the Apache HTTP server and you want to be able to compile or develop additional modules for Apache, you need to install this package.
The apr-devel package provides the support files which can be used to build applications using the APR library. The mission of the Apache Portable Runtime (APR) is to provide a free library of C data structures and routines.
For installing the said dependencies, I used the following command :
Since we have installed all the dependencies, lets proceed to the installation of the apache module mod_geoip.
For the same, we need to download the Package first.
Extract the downloaded package.
apxs is a tool for building and installing extension modules for the Apache web server. This is achieved by building a dynamic shared object (DSO) from one or more source or object files which then can be loaded into the Apache server under runtime via the LoadModule directive from mod_so.
I’ve used apxs command for building and installing the extension module mod_geoip. You can refer the link for the successful execution of the command.
Now we have to enable mod-geoip in your apache configuration. Otherwise it is not going to work. You’ll need the following lines in your httpd.conf file (/etc/httpd/conf/httpd.conf).
Restart Apache so your changes will take effect by entering the following command.
You can check whether the installation is complete and the module mod_geoip is enabled or not just by creating a php info page.