LiteSpeed Technologies
Download Download     Blog Blog     Wiki Wiki     Forum Forum     Store     Contact Contact    

Go Back   LiteSpeed Support Forums > LiteSpeed Web Server > General > GeoIP not working?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-30-2011, 10:06 AM
04nunhucks 04nunhucks is offline
Senior Member
 
Join Date: Jan 2008
Posts: 73
Default GeoIP not working?

Hello, I can't seem to get GeoIP working properly for use with scripts on my server.

Basically, I've enabled the IP GeoLocation in LS, at server level, and provided the .dat for it. I've also enabled it at VHOST level, and added a GeoIPEnable On directive to the relevant htaccess.

However, scripts cannot use functions, such as -Call to undefined function- geoip_database_info().

PHPInfo shows that _SERVER[GEOIP_*] (4 entries) and it's accurate, but I can't seem to get scripts to use the functions. Any ideas?
Reply With Quote
  #2  
Old 03-30-2011, 11:18 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,337
You need to add geoip support (download & install pecl geoip, load geoip.so to lsphp5 ) to lsphp5.
Reply With Quote
  #3  
Old 03-30-2011, 11:43 AM
04nunhucks 04nunhucks is offline
Senior Member
 
Join Date: Jan 2008
Posts: 73
Hello webizen, how do I do this?
Reply With Quote
  #4  
Old 03-30-2011, 11:55 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,337
Here is the procedure:
  1. download pecl geoip from http://pecl.php.net/package/geoip
    wget http://pecl.php.net/get/geoip-1.0.7.tgz
  2. build geoip.so module
    tar zxf geoip-1.0.7.tgz
    cd geoip-1.0.7
    /usr/local/lsws/lsphp5/bin/phpize
    ./configure --with-php-config=/usr/local/lsws/lsphp5/bin/php-config
    make
    make install
    Note:
    a. you need to install geoip and geoip-devel rpm if not done so (yum install GeoIP-devel).
    b. /usr/local/lsws/lsphp5 is the prefix of running lsphp5.
  3. add line "extension=geoip.so" to your lsphp5 php.ini file.
  4. restart lsws to make it effective.
Reply With Quote
  #5  
Old 03-30-2011, 11:56 AM
04nunhucks 04nunhucks is offline
Senior Member
 
Join Date: Jan 2008
Posts: 73
Thanks webizen!
Reply With Quote
  #6  
Old 03-31-2011, 08:10 AM
04nunhucks 04nunhucks is offline
Senior Member
 
Join Date: Jan 2008
Posts: 73
Webizen, when I try to use some functions, as in the code below,

PHP Code:
<?php
if (geoip_db_avail(GEOIP_CITY_EDITION_REV1))
    print 
geoip_database_info(GEOIP_CITY_EDITION_REV1)."<br>";
$record geoip_record_by_name("www.google.com");
if (
$record) {
    
print_r($record);
}
else {
    print 
"No location found!";
}
?>
It doesn't work - the function is just failing.
Reply With Quote
  #7  
Old 04-15-2011, 07:51 AM
DanEZPZ DanEZPZ is offline
Senior Member
 
Join Date: Jul 2009
Posts: 53
Quote:
Originally Posted by webizen View Post
Here is the procedure:
  1. download pecl geoip from http://pecl.php.net/package/geoip
    wget http://pecl.php.net/get/geoip-1.0.7.tgz
  2. build geoip.so module
    tar zxf geoip-1.0.7.tgz
    cd geoip-1.0.7
    /usr/local/lsws/lsphp5/bin/phpize
    ./configure --with-php-config=/usr/local/lsws/lsphp5/bin/php-config
    make
    make install
    Note:
    a. you need to install geoip and geoip-devel rpm if not done so (yum install GeoIP-devel).
    b. /usr/local/lsws/lsphp5 is the prefix of running lsphp5.
  3. add line "extension=geoip.so" to your lsphp5 php.ini file.
  4. restart lsws to make it effective.
I assume these instructions are outdated as the path /usr/local/lsws/lsphp5/bin no longer exists.
Reply With Quote
  #8  
Old 04-15-2011, 09:59 AM
webizen webizen is offline
LiteSpeed Staff
 
Join Date: Oct 2010
Posts: 2,337
As the note(b) indicates, you need to check the prefix of your running lsphp5.
Quote:
/usr/local/lsws/fcgi-bin/lsphp5 -i | grep prefix
Reply With Quote
  #9  
Old 04-16-2013, 03:50 AM
johncaradonnas johncaradonnas is offline
New Member
 
Join Date: Apr 2013
Posts: 1
Last Friday I have searched some solutions about magento extensions and I have found Geo-IP lock extension on some websites. But there was some errors on sites but I saw a demo on fmeextensions.com/magento-geo-ip-ultimate-lock.html where it was perfectly.
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 10:23 AM.



- Archive - Top
© Copyright 2003-2011 LiteSpeed Technologies, Inc. All rights reserved. Privacy Policy.