首先安装 libmaxminddb
$ git clone --recursive https://github.com/maxmind/libmaxminddb
$ cd libmaxminddb
$ ./bootstrap
$ ./configure --with-php-config=/www/server/php/72/bin/php-config
$ make
$ sudo make install
$ sudo ldconfig
然后编译 maxminddb
$ git clone https://github.com/maxmind/MaxMind-DB-Reader-php
$ cd MaxMind-DB-Reader-php/ext
$ phpize
$ ./configure --with-php-config=/www/server/php/72/bin/php-config
$ make
$ sudo make install
最后在 php.ini
中添加
extension = maxminddb.so