Location of GeoIP.dat for PHP

To find the location of GeoIP for PHP you can ssh into the server and use the “find” command.

find / -iname GeoIP.dat

Will return a list of file paths where the file with this name is found. In my case I found:

/usr/share/GeoIP/GeoIP.dat
/usr/local/share/GeoIP/GeoIP.dat
/opt/geoip/share/GeoIP/GeoIP.dat

In my case the bottom link was the one that PHP was searching for, To confirm this i moved the file and PHP started to complain that it couldn’t find the file.

Previously because I was updating the wrong file it didn’t update my install so PHP was returning old and wrong data.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.