Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Geoip for php 8 #1034

Closed
jeff1326 opened this issue Dec 17, 2024 · 6 comments
Closed

Geoip for php 8 #1034

jeff1326 opened this issue Dec 17, 2024 · 6 comments
Labels
enhancement New feature or request

Comments

@jeff1326
Copy link

Could you use this repos instead for Geoip ?

https://github.com/rlerdorf/geoip

This is what we used for few years now.

P.S. Geoip2 would make sense too : https://github.com/maxmind/GeoIP2-php

@jeff1326 jeff1326 added the enhancement New feature or request label Dec 17, 2024
@mlocati
Copy link
Owner

mlocati commented Dec 17, 2024

Is that extension published on pecl?

@mlocati
Copy link
Owner

mlocati commented Dec 17, 2024

P.S. Geoip2 would make sense too : https://github.com/maxmind/GeoIP2-php

Is this a PHP module (aka extension)? Or it's a PHP project?

@jeff1326
Copy link
Author

Is that extension published on pecl?

No, unfortunately i can't find it on pecl.

Here's what we did on our side

RUN apk add --no-cache --update -t virt-deps $PHPIZE_DEPS geoip-dev mpdecimal-dev \
    && apk add --no-cache --update geoip \
    && cd /opt \
    && wget https://github.com/rlerdorf/geoip/archive/refs/tags/1.3.1.tar.gz \
    && tar xvf 1.3.1.tar.gz \
    && cd geoip-1.3.1/ \
    && phpize \
    && ./configure \
    && make \
    && make install \
    && docker-php-ext-enable geoip \
    && cd ../ && rm -fr geoip-1.3.1 1.3.1.tar.gz \
    && apk del virt-deps
    
RUN mkdir -p /usr/share/GeoIP \
    && curl http://***.***.***.***/geoip/GeoIPCity.dat -o /usr/share/GeoIP/GeoIPCity.dat

Star in the curl address is a local server in our infrastructure for caching.

P.S. Geoip2 would make sense too : https://github.com/maxmind/GeoIP2-php

Is this a PHP module (aka extension)? Or it's a PHP project?
For Geoip2, an information about it would be interesting in the Supported PHP extensions list.

It's available by 2 way

Here's a example how to use it : https://www.php.net/manual/en/book.geoip.php#123492

@mlocati
Copy link
Owner

mlocati commented Dec 17, 2024

About https://github.com/rlerdorf/geoip: keeping support for PHP modules that are not published on pecl requires a lot of manual support and special handling of updates. What about asking them to publish it on PECL?

About https://github.com/maxmind/GeoIP2-php: as you wrote, it's a PHP project, not a PHP extension written in C, so you can install it with composer and not with install-php-extensions.

@jeff1326
Copy link
Author

jeff1326 commented Dec 17, 2024

For https://github.com/rlerdorf/geoip : An issue has been opened about that but there's nothing since 2021 rlerdorf/geoip#1 I think we should forget about this one.

For https://github.com/maxmind/GeoIP2-php : I think a mention should be put in your documentation to use that instead for Php 8 for new user who may need this functionality

A big thank you for how responsive you are on this repository. Very impressive !

@mlocati
Copy link
Owner

mlocati commented Dec 17, 2024

If the rlerdof project has such a relevant issue open for 3 years I don't think it's maintained that much (another reason for not adding support to it).

For https://github.com/maxmind/GeoIP2-php : I think a mention should be put in your documentation to use that instead for Php 8 for new user who may need this functionality

Are you suggesting that I should describe any composer-based alternative that has some reations with all the supported C extensions? For sure I won't do that.
Or do you mean that I should state that installl-php-extensions is for installing PHP extensions instead of composer-based projects? I think it's already well described in the readme.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants