3

I'm currently working on an application that needs some GeoIP functions, I've gotten the extension from http://windows.php.net/downloads/pecl/releases/geoip/1.0.8/ however, i'm having some difficulties installing the extension on xampp for windows. Please i need help on this...

i know how to install it on other systems:

To install geoip on debian lenny:

wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
gunzip GeoLiteCity.dat.gz
sudo mkdir -v /usr/share/GeoIP
sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat

sudo apt-get install php5-geoip

But i still dont know how to do in in windows XAMPP. PLEASE HELP.

Tamara
  • 417
  • 1
  • 6
  • 20

4 Answers4

7

For PHP version 5.6 in xampp with windows 7,10
Create test.php inside your htdocs directory and type echo phpinfo(); and run it in any browser

Architecture of php

Check Architecture column from above image If it x86 then

  1. download geoip extension from http://windows.php.net/downloads/pecl/releases/geoip/1.1.0/php_geoip-1.1.0-5.6-ts-vc11-x86.zip
  2. Extract in your computer
  3. Copy php_geoip.dll to C:\xampp\php\ext\
  4. Add this line in the end of php.ini:- extension=php_geoip.dll
  5. Restart Apache
  6. Run test.php again which you have created above.
  7. Now you can see geoip is enabled enter image description here
Rajesh Patel
  • 1,946
  • 16
  • 20
6
  1. Copy the relevant library pecl.php.net/package/geoip/1.1.0/windows
  2. Extract in your computer
  3. Copy php_geoip.dll to C:\xampp\php\ext [Your xampp > php > ext folder (PHP 5)]
  4. Add extension=php_geoip.dll in php.ini
  5. Restart Apache
  6. If you downloaded wrong DLL it will give you error message like: platform missmatch
  7. go to phpinfo. find geoip
Sadee
  • 3,010
  • 35
  • 36
0

Install geoip on xampp

Geocoding (finding latitude/longitude for street addresses), Geotagging (tagging media with latitude/longitude coordinates), and Geolocation (finding latitude/longitude of computer with IP X-Forwarded-For). There are some options to install on linux environment:

# wget http://geolite.maxmind.com/download/geoip/database/GeoLiteCity.dat.gz
# gunzip GeoLiteCity.dat.gz
# sudo mkdir -v /usr/share/GeoIP
# sudo mv -v GeoLiteCity.dat /usr/share/GeoIP/GeoIPCity.dat

geoIP-Dat-Files.pngsource

Installing GeoIP on XAMPP for windows

In Windows environment we have to add extension php_geoip.dll with PHP Download extension from here : http://blog.svnlabs.com/php-5.2.1_geoip-w32.zip

Copy php_geoip.dll to xampp php/ext .. add a line in php.ini extension=php_geoip.dll and restart xampp

thats all :)

classicjonesynz
  • 4,012
  • 5
  • 38
  • 78
Tamara
  • 417
  • 1
  • 6
  • 20
0

I needed to use the GeoIP for Xampp with the .HTACCESS method but i couldn't make it work with Rajesh solution so, this is what it worked for me:

  1. Download the right VC version from ApacheHouse (you can check your compilation version and architecture with echo phpinfo();)
  2. Follow the readme_first.html included in the downloaded ZIP file to install GeoIP*.

    • Copy the database to -> c:/xampp/apache/bin/geoip.dat
    • Copy the mod_geoip.so to -> c:/xampp/apache/modules/mod_geoips.so
    • Load the mod_geoip.so in httpd.conf -> LoadModule geoip_module modules/mod_geoip.so
    • Add in httpd.conf at the bottom:

      <IfModule geoip_module>
          GeoIPEnable On
          GeoIPDBFile bin/GeoIP.dat
      </IfModule>
      
    • Restart Apache service

honk
  • 9,137
  • 11
  • 75
  • 83
Jordi
  • 616
  • 2
  • 9
  • 16