I want to configure GeoIP to redirect domain to a subdomains according to country IP address in a shared server. I have created a custom php.ini
to import geoip.so then in my index.php
I added this code:
<?php
require_once('/home/fuiba/php.ini');
$gi = geoip_open('GeoIP.dat', GEOIP_MEMORY_CACHE);
$country = geoip_country_code_by_addr($gi, $_SERVER['REMOTE_ADDR']);
geoip_close($gi);
$my_countries = 'fr';
if (strtolower($country) == $my_countries) {
header('Location: fr.fuiba.org');
}
$my_countriessss = 'us';
if (strtolower($country) == $my_countriessss) {
header('Location: en.fuiba.org');
}
?>
In the browser I get this error:
extension=geoip.so
Fatal error: Call to undefined function geoip_open() in /home/fuiba/public_html/index.php on line 3
The GeoIP is installed in the Server. I checked it on info.php: geoip version 1.0.8.