MaxMind GeoIP API: fseek() [function.fseek]: stream does not support seeking in geoip.inc

浪尽此生 提交于 2019-12-23 06:44:11

问题


I'm using MaxMind's GeoIP service as such:

<?php
    include("geoip/geoip.inc");
    include("geoip/geoipcity.inc");
    include('geoip/geoipregionvars.php');
    $gi = geoip_open("http://watchandrepeat.com/GeoLiteCity.dat", GEOIP_STANDARD);
?>

It turns out that the geopi_open API uses fseek, and it is failing on my web server:

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

As of this writing, you can see it failing here: http://watchandrepeat.com/indextest.php

I am using IxWebHosting, and I asked their customer support if it's possible to turn on stream seeking on their apache server, as it works just fine on my localhost. They said this: "I am sorry, but it is impossible to turn on such a function on our Shared Server. I would like to recommend you to use our VPS or Cloud hosting plans. You will be able to configure your own server as you wish."

Is there any kind of work around?


回答1:


From the PHP manual:

"Not all streams support seeking. For those that do not support seeking, forward seeking from the current position is accomplished by reading and discarding data; other forms of seeking will fail."

HTTP is one of those streams that don't support seeking. That's exactly what your error message states, stream [HTTP] does not support seeking. Treat your database as local and get rid of the URL and it should work.



来源:https://stackoverflow.com/questions/20022743/maxmind-geoip-api-fseek-function-fseek-stream-does-not-support-seeking-in

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!