Coder Social home page Coder Social logo

geoip-api-php's People

Contributors

2shortplanks avatar andyjack avatar autarch avatar borisz avatar horgh avatar kolahzary avatar loranger avatar makasim avatar nchelluri avatar nyholm avatar oalders avatar oschwald avatar peter-gribanov avatar wedi avatar wesrice avatar xabbuh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

geoip-api-php's Issues

Noob friendly enhancement @ GEOIP_SHARED_MEMORY

This will automatically load the db in to shared memory. The API in current shape is bit confusing for noob.

geoip.inc#383

if ($gi->flags & GEOIP_SHARED_MEMORY) {
$gi->shmid = @shmop_open (GEOIP_SHM_KEY, "a", 0, 0);
// @change - handle cache-miss
if ($gi->shmid === FALSE) { geoip_load_shared_mem($filename); }
} else {

Thanks,

DID A PULL REQUEST ### SO CLOSING THIS ISSUE ### THANKS

Malta ('MT') missing from country / region list

We're using a Yii implementation of geoip, but people from Malta ('MT') reported it broken.

The error they received was...

Undefined index MT

...at the following line:

  public static function getRegionName($countryCode, $regionCode) {
    if ($countryCode === null || $regionCode === null) {
      return null;
    }
    return self::$crnMap[$countryCode][$regionCode]; // <--- this is where the error pointed
  }

The person who built the extension for Yii used your geoipregionvars.php file as its basis, I guess, and when having a look at it, I do miss 'MT'.

What is this list based on, and is there a specific reason why Malta ('MT') (and I'm pretty sure several other countries) aren't on the list?

PHP Warning: fseek(): 16 is not a valid stream resource

Yesterday I was updated geoip.inc and geoip.dat and get this errors. My log file reached 2GB size.

I tried use if (is_resource($gi->filehandle)) {...} but is not right solution

[25-Oct-2017 19:43:28 Europe/Moscow] PHP Fatal error:  GeoIP API: Error traversing database - perhaps it is corrupt? in /var/www/userx/data/www/site.ru/includes/class.geoip.php on line 1774
[25-Oct-2017 19:44:26 Europe/Moscow] PHP Warning:  fseek(): 16 is not a valid stream resource in /var/www/userx/data/www/site.ru/includes/class.geoip.php on line 1750
[25-Oct-2017 19:44:26 Europe/Moscow] PHP Warning:  fread(): 16 is not a valid stream resource in /var/www/userx/data/www/site.ru/includes/class.geoip.php on line 1752

Problem in this func

function _geoip_seek_country($gi, $ipnum)
{
    $offset = 0;
    for ($depth = 31; $depth >= 0; --$depth) {
        if ($gi->flags & GEOIP_MEMORY_CACHE) {
            $buf = _safe_substr(
                $gi->memory_buffer,
                2 * $gi->record_length * $offset,
                2 * $gi->record_length
            );
        } elseif ($gi->flags & GEOIP_SHARED_MEMORY) {
            $buf = _sharedMemRead(
                $gi,
                2 * $gi->record_length * $offset,
                2 * $gi->record_length
            );
        } else {
            fseek($gi->filehandle, 2 * $gi->record_length * $offset, SEEK_SET) == 0
            or trigger_error("GeoIP API: fseek failed", E_USER_ERROR);
            $buf = fread($gi->filehandle, 2 * $gi->record_length);
        }
        $x = array(0, 0);
        for ($i = 0; $i < 2; ++$i) {
            for ($j = 0; $j < $gi->record_length; ++$j) {
                $x[$i] += ord($buf[$gi->record_length * $i + $j]) << ($j * 8);
            }
        }
        if ($ipnum & (1 << $depth)) {
            if ($x[1] >= $gi->databaseSegments) {
                return $x[1];
            }
            $offset = $x[1];
        } else {
            if ($x[0] >= $gi->databaseSegments) {
                return $x[0];
            }
            $offset = $x[0];
        }
    }
    trigger_error("GeoIP API: Error traversing database - perhaps it is corrupt?", E_USER_ERROR);
    return false;
}

Dependabot can't resolve your PHP dependency files

Dependabot can't resolve your PHP dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for geoip/geoip No version set (parsed as 1.0.0) -> satisfiable by geoip/geoip[No version set (parsed as 1.0.0)].
    - ext-geoip 1.1.1 conflicts with geoip/geoip[No version set (parsed as 1.0.0)].
    - Installation request for ext-geoip 1.1.1 -> satisfiable by ext-geoip[1.1.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.3/cli/php.ini
    - /etc/php/7.3/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.3/cli/conf.d/10-opcache.ini
    - /etc/php/7.3/cli/conf.d/10-pdo.ini
    - /etc/php/7.3/cli/conf.d/15-xml.ini
    - /etc/php/7.3/cli/conf.d/20-apcu.ini
    - /etc/php/7.3/cli/conf.d/20-bcmath.ini
    - /etc/php/7.3/cli/conf.d/20-calendar.ini
    - /etc/php/7.3/cli/conf.d/20-ctype.ini
    - /etc/php/7.3/cli/conf.d/20-curl.ini
    - /etc/php/7.3/cli/conf.d/20-dom.ini
    - /etc/php/7.3/cli/conf.d/20-exif.ini
    - /etc/php/7.3/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.3/cli/conf.d/20-ftp.ini
    - /etc/php/7.3/cli/conf.d/20-gd.ini
    - /etc/php/7.3/cli/conf.d/20-geoip.ini
    - /etc/php/7.3/cli/conf.d/20-gettext.ini
    - /etc/php/7.3/cli/conf.d/20-gmp.ini
    - /etc/php/7.3/cli/conf.d/20-iconv.ini
    - /etc/php/7.3/cli/conf.d/20-igbinary.ini
    - /etc/php/7.3/cli/conf.d/20-imagick.ini
    - /etc/php/7.3/cli/conf.d/20-imap.ini
    - /etc/php/7.3/cli/conf.d/20-intl.ini
    - /etc/php/7.3/cli/conf.d/20-json.ini
    - /etc/php/7.3/cli/conf.d/20-ldap.ini
    - /etc/php/7.3/cli/conf.d/20-mbstring.ini
    - /etc/php/7.3/cli/conf.d/20-mongodb.ini
    - /etc/php/7.3/cli/conf.d/20-msgpack.ini
    - /etc/php/7.3/cli/conf.d/20-mysqli.ini
    - /etc/php/7.3/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.3/cli/conf.d/20-pdo_sqlite.ini
    - /etc/php/7.3/cli/conf.d/20-phar.ini
    - /etc/php/7.3/cli/conf.d/20-posix.ini
    - /etc/php/7.3/cli/conf.d/20-readline.ini
    - /etc/php/7.3/cli/conf.d/20-redis.ini
    - /etc/php/7.3/cli/conf.d/20-shmop.ini
    - /etc/php/7.3/cli/conf.d/20-simplexml.ini
    - /etc/php/7.3/cli/conf.d/20-soap.ini
    - /etc/php/7.3/cli/conf.d/20-sockets.ini
    - /etc/php/7.3/cli/conf.d/20-sqlite3.ini
    - /etc/php/7.3/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.3/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.3/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.3/cli/conf.d/20-tidy.ini
    - /etc/php/7.3/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.3/cli/conf.d/20-wddx.ini
    - /etc/php/7.3/cli/conf.d/20-xmlreader.ini
    - /etc/php/7.3/cli/conf.d/20-xmlwriter.ini
    - /etc/php/7.3/cli/conf.d/20-xsl.ini
    - /etc/php/7.3/cli/conf.d/20-zip.ini
    - /etc/php/7.3/cli/conf.d/20-zmq.ini
    - /etc/php/7.3/cli/conf.d/25-apcu_bc.ini
    - /etc/php/7.3/cli/conf.d/25-memcached.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

View the update logs.

Default timezone

Wouldn't be better if a timezone is set if the region is not set?

For example:

// Constructor
function get_time_zone($country, $region = null)

Then

            switch ($region) {
                default: // Added the default timezone for country based on it's capital (or near from it) if $region is not set
                case "01":
                    $timezone = "Australia/Sydney";
                    break;
                case "02":
                    $timezone = "Australia/Sydney";
                    break;
                case "03":
                    $timezone = "Australia/Darwin";
                    break;
                case "04":
                    $timezone = "Australia/Brisbane";
                    break;
                case "05":
                    $timezone = "Australia/Adelaide";
                    break;
                case "06":
                    $timezone = "Australia/Hobart";
                    break;
                case "07":
                    $timezone = "Australia/Melbourne";
                    break;
                case "08":
                    $timezone = "Australia/Perth";
                    break;
        }

Wrong detection of the IRELAND ips

Hi,

I'm using your latest code with latest GeoIp.dat file.
Some ips, for example,
52.208.219.197, 52.208.234.53, 52.209.60.202, 52.209.69.178, 52.209.239.192, 52.210.87.79 (and more),
gives wrong result on different requests.
the same code is used, but different results received.,..

|| time || ip || detected_country ||
|| 2016-09-10 08:05:32 || 52.208.219.197 || IRL ||
|| 2016-09-10 10:11:18 || 52.208.219.197 || USA ||
|| 2016-09-10 11:29:54 || 52.208.219.197 || USA ||
|| 2016-09-11 00:24:19 || 52.208.219.197 || USA ||
|| 2016-09-11 05:22:19 || 52.208.219.197 || IRL ||
|| 2016-09-11 17:49:02 || 52.208.219.197 || IRL ||

Your help will be nice... (maybe heavy load on the file gives wrong results?)

Code Usage:
$gi = geoip_open('GeoIP.dat', 0);
$country = geoip_country_name_by_addr($gi, $ipAddress);
geoip_close($gi);

geoip/geoip v1.14 conflicts with ext-geoip[1.0.8]

Hi, i am try install dependenciesm but I got this errors.
Problem 1
- Installation request for ext-geoip 1.0.8 -> satisfiable by ext-geoip[1.0.8].
- geoip/geoip v1.14 conflicts with ext-geoip[1.0.8].
- Installation request for geoip/geoip ~1.14 -> satisfiable by geoip/geoip[v1.14].

Thank you for any help.

range_by_ip() missing

I'd need the function range_by_ip as it is in the python implementation of the library.
Is it possible to have it in the php library too?

API calls fail using ubuntu-provided database files

When using the php api on the geoip database files as provided by Ubuntu in the geoip-database package, calls fail with an error. This happens at least with the databases available in Ubuntu saucy and raring, and probably also in precise (LTS).

The output when testing with sample.php in v1.13:

PHP Notice:  Undefined offset: -16776959 in /home/username/geoip/geoip/geoip.inc on line 484
PHP Stack trace:
PHP   1. {main}() /home/username/geoip/geoip/sample.php:0
PHP   2. geoip_country_code_by_addr() /home/username/geoip/geoip/sample.php:13
PHP Notice:  Undefined offset: -16776959 in /home/username/geoip/geoip/geoip.inc on line 505
PHP Stack trace:
PHP   1. {main}() /home/username/geoip/geoip/sample.php:0
PHP   2. geoip_country_name_by_addr() /home/username/geoip/geoip/sample.php:14

PHP Notice:  Undefined offset: -16776959 in /home/username/geoip/geoip/geoip.inc on line 484
PHP Stack trace:
PHP   1. {main}() /home/username/geoip/geoip/sample.php:0
PHP   2. geoip_country_code_by_addr() /home/username/geoip/geoip/sample.php:15
PHP Notice:  Undefined offset: -16776959 in /home/username/geoip/geoip/geoip.inc on line 505
PHP Stack trace:
PHP   1. {main}() /home/username/geoip/geoip/sample.php:0
PHP   2. geoip_country_name_by_addr() /home/username/geoip/geoip/sample.php:16

Using the geoiplookup command (from ubuntu package geoip) does result in valid results, so I'm not really sure where the issue is. When downloading a GeoIP.dat file from the MaxMind website, and putting that in place of the ubuntu-provided file results in working calls from both the php api and the cli tool, so I'm unsure where to start debugging this.

When reviewing the ubuntu source code for the package, it seems that they build the database themselves from CSV files. Maybe someone from Maxmind can help out in describing why the resulting dat file is problematic when used with the php api?

I have no problem filing a bug at Ubuntu/Debian for this, but I probably need some more details on what the actual problem is with the files they create...

fseek not supported, please rewrite to use file_get_contents()

I'm getting this error:
Warning: fseek() [function.fseek]: stream does not support seeking in /hsphere/local/home/yudaluz/watchandrepeat.com/geoip/geoip.inc on line 319

Online research indicates that not all servers support fseek as used here.
Please rewrite to use file_get_contents() - which I understand is better supported.

Thanks,
Etay

Not compatible with PHP 8.0.0 RC1

I'm still using this extension with a legacy app, and we're trying to test against PHP 8 for future compat and seeing if the JIT helps us with a particular workload.

If there any chance that this'll be updated to support PHP 8? It seems like a not-insignificant amount of work to use https://github.com/maxmind/GeoIP2-php since the databases aren't shipped with it.

new binary format?

I have binary db GEO-132 20130903 Build 1 (GeoIPCity.dat), but this api doesn't work with that db. For example, if i try get country id by addr, I receive strange id like -9593646 (for germany), or -9592596 (for Netherlands). Also I try use java api, but i get the same ids.

Minimum PHP version

Can you please specify in the description the minimum PHP version needed for the API to work?
My script support also very old versions of PHP so I want include the API only where it works.

Installation WPML_GeoIP_IPResolver.class.php

Hey, I followed your readme but I cant understand what I should do in the WPML_GeoIP_IPResolver.class.php

My site is in english

homepage.com

But when someone from Sweden enter I want it to redirect to

homepage.com/sv

You say I should modify the language_mappings and default_language but to what?

   //Array with structure MaxMind Code => WPML Code 
   $this->language_mappings = array(
   'US' => 'en', //USA
   'SE' => 'sv', //Sweden
        );**
    //Set the default WPML language which is used if no matching language is found
    $this->default_language = 'en';

Whats wrong here?

inconsistancy in quotes

why are in https://github.com/maxmind/geoip-api-php/src/geoipregionvars.php some numbers in the array surrounded by quotes, and some are not?
In thought they all needed to be in quotes
for example
'AF' => array ( '01' => 'Badakhshan', '02' => 'Badghis', '03' => 'Baghlan', '05' => 'Bamian', '06' => 'Farah', '07' => 'Faryab', '08' => 'Ghazni', '09' => 'Ghowr', 10 => 'Helmand', 11 => 'Herat', 13 => 'Kabol', 14 => 'Kapisa', 17 => 'Lowgar', 18 => 'Nangarhar', 19 => 'Nimruz', 23 => 'Kandahar', 24 => 'Kondoz', 26 => 'Takhar', 27 => 'Vardak', 28 => 'Zabol', 29 => 'Paktika', 30 => 'Balkh', 31 => 'Jowzjan', 32 => 'Samangan', 33 => 'Sar-e Pol', 34 => 'Konar', 35 => 'Laghman', 36 => 'Paktia', 37 => 'Khowst', 38 => 'Nurestan', 39 => 'Oruzgan', 40 => 'Parvan', 41 => 'Daykondi', 42 => 'Panjshir', ),

Make autoloading of geoipcity.inc optional

Loading of geoipcity.inc adds about 30ms to response time on my Windows 7 machine. For example loading facebook PHP API adds only 5ms to the response time. I know its not a lot but since I only need geoip.inc for countries it would be nice if I could only include geoipcity.inc if I really need it. You could maybe put in your documentation that if user wants this he should add it to his composer.json autoload section.

Getting region

geoip_region_by_addr( $gi, $addr) seems not to work, neither _get_region(). Anybody knows why?

Timezone ID invalid

One single visitor create this php error report:

date_default_timezone_set(): Timezone ID 'Asia/Tokyo, session_database=1ee2a5f346389b7f02332231e08def84384d5411~54fb28e5cf93a2-08272203' is invalid

The timezone string from geoip_time_zone_by_country_and_region() included the session id separated with a comma ","? How can this happen? Is this a bug in php (5.5.22)?

should be created by this code (short version)

    $result = geoip_record_by_name('180.144.227.111');
    if ($result)
    {           date_default_timezone_set(geoip_time_zone_by_country_and_region($result['country_code'],$result['region']));
    }

I have tested with original code and its working fine for this IP.

Dependabot can't resolve your PHP dependency files

Dependabot can't resolve your PHP dependency files.

As a result, Dependabot couldn't update your dependencies.

The error Dependabot encountered was:

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for geoip/geoip No version set (parsed as 1.0.0) -> satisfiable by geoip/geoip[No version set (parsed as 1.0.0)].
    - ext-geoip 1.1.1 conflicts with geoip/geoip[No version set (parsed as 1.0.0)].
    - Installation request for ext-geoip 1.1.1 -> satisfiable by ext-geoip[1.1.1].

  To enable extensions, verify that they are enabled in your .ini files:
    - /etc/php/7.3/cli/php.ini
    - /etc/php/7.3/cli/conf.d/10-mysqlnd.ini
    - /etc/php/7.3/cli/conf.d/10-opcache.ini
    - /etc/php/7.3/cli/conf.d/10-pdo.ini
    - /etc/php/7.3/cli/conf.d/15-xml.ini
    - /etc/php/7.3/cli/conf.d/20-apcu.ini
    - /etc/php/7.3/cli/conf.d/20-bcmath.ini
    - /etc/php/7.3/cli/conf.d/20-calendar.ini
    - /etc/php/7.3/cli/conf.d/20-ctype.ini
    - /etc/php/7.3/cli/conf.d/20-curl.ini
    - /etc/php/7.3/cli/conf.d/20-dom.ini
    - /etc/php/7.3/cli/conf.d/20-exif.ini
    - /etc/php/7.3/cli/conf.d/20-fileinfo.ini
    - /etc/php/7.3/cli/conf.d/20-ftp.ini
    - /etc/php/7.3/cli/conf.d/20-gd.ini
    - /etc/php/7.3/cli/conf.d/20-geoip.ini
    - /etc/php/7.3/cli/conf.d/20-gettext.ini
    - /etc/php/7.3/cli/conf.d/20-gmp.ini
    - /etc/php/7.3/cli/conf.d/20-iconv.ini
    - /etc/php/7.3/cli/conf.d/20-igbinary.ini
    - /etc/php/7.3/cli/conf.d/20-imagick.ini
    - /etc/php/7.3/cli/conf.d/20-imap.ini
    - /etc/php/7.3/cli/conf.d/20-intl.ini
    - /etc/php/7.3/cli/conf.d/20-json.ini
    - /etc/php/7.3/cli/conf.d/20-ldap.ini
    - /etc/php/7.3/cli/conf.d/20-mbstring.ini
    - /etc/php/7.3/cli/conf.d/20-mongodb.ini
    - /etc/php/7.3/cli/conf.d/20-msgpack.ini
    - /etc/php/7.3/cli/conf.d/20-mysqli.ini
    - /etc/php/7.3/cli/conf.d/20-pdo_mysql.ini
    - /etc/php/7.3/cli/conf.d/20-pdo_sqlite.ini
    - /etc/php/7.3/cli/conf.d/20-phar.ini
    - /etc/php/7.3/cli/conf.d/20-posix.ini
    - /etc/php/7.3/cli/conf.d/20-readline.ini
    - /etc/php/7.3/cli/conf.d/20-redis.ini
    - /etc/php/7.3/cli/conf.d/20-shmop.ini
    - /etc/php/7.3/cli/conf.d/20-simplexml.ini
    - /etc/php/7.3/cli/conf.d/20-soap.ini
    - /etc/php/7.3/cli/conf.d/20-sockets.ini
    - /etc/php/7.3/cli/conf.d/20-sqlite3.ini
    - /etc/php/7.3/cli/conf.d/20-sysvmsg.ini
    - /etc/php/7.3/cli/conf.d/20-sysvsem.ini
    - /etc/php/7.3/cli/conf.d/20-sysvshm.ini
    - /etc/php/7.3/cli/conf.d/20-tidy.ini
    - /etc/php/7.3/cli/conf.d/20-tokenizer.ini
    - /etc/php/7.3/cli/conf.d/20-wddx.ini
    - /etc/php/7.3/cli/conf.d/20-xmlreader.ini
    - /etc/php/7.3/cli/conf.d/20-xmlwriter.ini
    - /etc/php/7.3/cli/conf.d/20-xsl.ini
    - /etc/php/7.3/cli/conf.d/20-zip.ini
    - /etc/php/7.3/cli/conf.d/20-zmq.ini
    - /etc/php/7.3/cli/conf.d/25-apcu_bc.ini
    - /etc/php/7.3/cli/conf.d/25-memcached.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

If you think the above is an error on Dependabot's side please don't hesitate to get in touch - we'll do whatever we can to fix it.

CentOS7 and PHP8.0 geoip.c: ‘OnUpdateDirectory’:

[root@dev geoip-1.1.1]# make
/bin/sh /usr/local/src/a/geoip-1.1.1/libtool --mode=compile cc -I. -I/usr/local/src/a/geoip-1.1.1 -I/usr/local/src/a/geoip-1.1.1/include -I/usr/local/src/a/geoip-1.1.1/main -I/usr/local/src/a/geoip-1.1.1 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/a/geoip-1.1.1/geoip.c -o geoip.lo
mkdir .libs
cc -I. -I/usr/local/src/a/geoip-1.1.1 -I/usr/local/src/a/geoip-1.1.1/include -I/usr/local/src/a/geoip-1.1.1/main -I/usr/local/src/a/geoip-1.1.1 -I/usr/local/php/include/php -I/usr/local/php/include/php/main -I/usr/local/php/include/php/TSRM -I/usr/local/php/include/php/Zend -I/usr/local/php/include/php/ext -I/usr/local/php/include/php/ext/date/lib -DHAVE_CONFIG_H -g -O2 -c /usr/local/src/a/geoip-1.1.1/geoip.c -fPIC -DPIC -o .libs/geoip.o
/usr/local/src/a/geoip-1.1.1/geoip.c: 在函数‘OnUpdateDirectory’中:
/usr/local/src/a/geoip-1.1.1/geoip.c:141:75: 错误:expected ‘)’ before ‘TSRMLS_CC’
return OnUpdateString(entry, new_value, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC);
^
/usr/local/src/a/geoip-1.1.1/geoip.c: 在函数‘zif_geoip_db_avail’中:
/usr/local/src/a/geoip-1.1.1/geoip.c:264:44: 错误:expected ‘)’ before ‘TSRMLS_CC’
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &edition) == FAILURE) {
^
/usr/local/src/a/geoip-1.1.1/geoip.c:264:44: 错误:提供给函数‘zend_parse_parameters’的实参太少
In file included from /usr/local/php/include/php/main/php.h:35:0,
from /usr/local/src/a/geoip-1.1.1/geoip.c:32:
/usr/local/php/include/php/Zend/zend_API.h:304:22: 附注:在此声明
ZEND_API zend_result zend_parse_parameters(uint32_t num_args, const char *type_spec, ...);
^
/usr/local/src/a/geoip-1.1.1/geoip.c:270:25: 错误:expected ‘)’ before ‘TSRMLS_CC’
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Database type given is out of bound.");

make: *** [geoip.lo] 错误 1

PHP memory requirement

Hi!
Do you have any experience regarding the memory requirement of using the Legacy GeoIP database in PHP with your API?
I use your API in my WordPress Plugin and got a few users complaing about a
Fatal error: error traversing database - perhaps it is corrupt? in geoip.inc on line 613.
I checked google and found a few people saying this is caused by a memory_limit that's too low. Do you have a value I should require?

prevent missing mb_internal_encoding function causing errors

You should check if the mb_internal_encoding function is available to prevent fatal errors:

if(function_exists('mb_internal_encoding')){
    $enc = mb_internal_encoding();
    mb_internal_encoding('ISO-8859-1'); 
}

//later
if(isset($enc)) mb_internal_encoding($enc);

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.