I need to detect visitor's country from his IP so I can display specific code based on the user location (different ads, etc.) in my PHP website.
There is many different external services such as Ip-api.org which does this, but I want to do it internally on the server (it's faster).
How to do it? What do I need to install or what do google out?
Ideally with some open-source licence.