I’ve been trying to debug this error for over three hours now, changing filenames, trying to use GeoIP Lite instead of GeoCity (the latter has a 27mb file to be included, so did this thinking fopen() had a max), etc.
Here’s my structure file structure: index.php -> include("configuration/config.php") - config.php -> include("inc/geo_text.php") -> geo_text.php
The contents of geo_text.php is:
$ip = $_SERVER['REMOTE_ADDR'];
include("GeoIP/geoip.inc");
$gi = geoip_open("GeoIP/GeoIP.dat",GEOIP_STANDARD);
$count_name = geoip_country_name_by_addr($gi, $ip);
geoip_close($gi);
echo($count_name);
Now, if I access geo_text.php no errors are given, and just to make sure I placed echo($count_name) in geo_text.php and it returned, as it should, my country.
However, when I run config.php it returns the error:
Warning: fopen(GeoIP/GeoIP.dat) [function.fopen]: failed to open stream: No such file or directory in /nfs/c09/h02/mnt/177978/domains/domain.com/html/labs/final/configuration/inc/GeoIP/geoip.inc on line 399
Can not open GeoIP/GeoIP.dat
Has anyone got any ideas why this could be?
It’s a path issue.
should work.