
03-31-2011, 02:33 PM
|
|
LiteSpeed Staff
|
|
Join Date: Oct 2010
Posts: 2,337
|
|
Here is what GeoIP can do in LSWS (http://www.maxmind.com/http://www.li...read.php?t=830)
Quote:
Notes
GeoIP: Set GeoIP database in Server scope and enable GeoIP for specific vhosts. Processed GeoIP data is available in the SERVER environment variables in the variable name format of 'GEOIP_XYZ' where XYZ depends on edition of Maxmind product you use. Fully compatible with scripts designed for mod_geoip.
|
Once you see the $_SERVER[GEOIP_*] variables, GeoIP in LSWS is working properly.
You are trying to use GeoIP functions (http://www.php.net/manual/en/ref.geoip.php) in PHP which is outside of LSWS. That's why suggestion to add geoip support in lsphp5 is provided. Looks like your GeoDB data file isn't not in the right place. Hence the problem. Copy the GeoIP data file to /usr/share/GeoIP directory to let PHP GeoIP extension pick them up (http://www.php.net/manual/en/geoip.setup.php).
Once done, you can verify which database is available in your system with a script like the following:
PHP Code:
<?php
$cst = array(
'GEOIP_COUNTRY_EDITION' => GEOIP_COUNTRY_EDITION,
'GEOIP_REGION_EDITION_REV0' => GEOIP_REGION_EDITION_REV0,
'GEOIP_CITY_EDITION_REV0' => GEOIP_CITY_EDITION_REV0,
'GEOIP_ORG_EDITION' => GEOIP_ORG_EDITION,
'GEOIP_ISP_EDITION' => GEOIP_ISP_EDITION,
'GEOIP_CITY_EDITION_REV1' => GEOIP_CITY_EDITION_REV1,
'GEOIP_REGION_EDITION_REV1' => GEOIP_REGION_EDITION_REV1,
'GEOIP_PROXY_EDITION' => GEOIP_PROXY_EDITION,
'GEOIP_ASNUM_EDITION' => GEOIP_ASNUM_EDITION,
'GEOIP_NETSPEED_EDITION' => GEOIP_NETSPEED_EDITION,
'GEOIP_DOMAIN_EDITION' => GEOIP_DOMAIN_EDITION,
);
foreach ($cst as $k=>$v) {
echo $k.': '.geoip_db_filename($v).' '.(geoip_db_avail($v) ? 'Available':'').'<br>';
}
?>
Last edited by webizen; 03-31-2011 at 03:41 PM..
|