# how to install geoip for php74



## tony33 (Sep 2, 2020)

I would like to know how I can install geoip form maxmind pecl?  

I think I have it fully installed. I checked php inf function and it lists maxminddb . I have the original database which is geoip.dat  I think I might need to get the geoip2.dat the newer database.
When I use the functions in php it spits out  the error that the function doesn't exist or is undeclared pretty much saying the function doesn't exist.

However, me seeing that the extension is listed in phpinfo I am assuming that's its installed but It may seem I need to use the latest database. I read someone the new library uses  geoip2.dat and won't work with the old
outdated database.  So, I  am thinking I would need to get the latest database. I will do this soon but I don't think this will solve the problem since the error is saying the function doesn't exist. It's either I am not using the right function or the installation wasn't properly done.  Does anyone got any tips? 

Thank You in advance.


----------



## suntzu00 (Sep 2, 2020)

you'll need devel/php-maxminddb , net/geoipupdate 

/usr/local/etc/GeoIP.conf


```
# GeoIP.conf file for `geoipupdate` program, for versions >= 3.1.1.
# Used to update GeoIP databases from https://www.maxmind.com.
# For more information about this config file, visit the docs at
# https://dev.maxmind.com/geoip/geoipupdate/.

# `AccountID` is from your MaxMind account.
AccountID xxxxx

# Replace YOUR_LICENSE_KEY_HERE with an active license key associated
# with your MaxMind account.
LicenseKey xxxxxxxxxx

# `EditionIDs` is from your MaxMind account.
EditionIDs GeoLite2-ASN GeoLite2-City GeoLite2-Country
```

You'll need to create an account with maxmind and obtain an AccountID and a LicenseKey

`/usr/local/bin/geoipupdate -v`


```
-r--r--r--  1 root  wheel   1242574 Mar 27  2018 GeoIP.dat
-r--r--r--  1 root  wheel   2198555 Aug 17  2018 GeoIPv6.dat
-rw-r--r--  1 root  wheel   6853247 Sep  2 12:20 GeoLite2-ASN.mmdb
-rw-r--r--  1 root  wheel  62955316 Sep  2 12:20 GeoLite2-City.mmdb
-rw-r--r--  1 root  wheel   3865507 Sep  2 12:20 GeoLite2-Country.mmdb
```

You can see the old format(.dat) and new one(.mmdb)

And this is how you use it LINK


----------

