Install PECL GeoIP for PHP 8.1 ubuntu 22

2.1k Views Asked by At

I'm trying to use PHP's PECL functions for geoip such as geoip_country_code_by_name(). This obviously needs the Pecl geoip extension.

However, on Ubuntu 22 and for PHP 8.1, this extension doesn't work.

Approach 1:

apt install php8.1-geoip

failed, does not exist

Approach 2:

pecl install geoip-beta

failed, can't compile for php 8.1 make: *** [Makefile:202: geoip.lo] Error 1 ERROR: `make' failed

Approach 3: Installing it with phar composer

failed: only uses maxmind's mmdb format, and functions are different. I want to use the older GeoIP.dat files.

Any solutions?

1

There are 1 best solutions below

0
david On

GEOIP has no PHP 8.1 version, you should use Geoip2 to be right, Please refer to (Unable to locate package php8.1-geoip) (https://github.com/maxmind/GeoIP2-php)