Question

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?

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top