Error Opening File /var/lib/geoip/geoip.dat
/usr/local/ispconfig/server/cron_daily.sh Error Opening file /usr/share/GeoIP/GeoIP.dat anubix, Mar 8, 2011 #1 till Super Moderator Staff Member ISPConfig Developer GeoIP is normally not used by ispconfig, but if you enabled it in your webalizer configuration, then you need to install the geoip database as well. Try to install the geoip library with this command: apt-get install libgeoip1 which should install the geoip database as well. If you want to use a newer geoIP database, see here: http://www.electrictoolbox.com/update-geoip-dat-debian-5/ till, Mar 8, 2011 #2 (You must log in or sign up to reply here.) Show Ignored Content Share This Page Tweet Log in with Facebook Log in with Twitter Log in with Google Your name or email address: Do you already have an account? No, create an account now. Yes, my password is: Forgot your password? Stay logged in Sign up now! Forum Statistics Discussions: 53,549 Messages: 284,015 Members: 91,710 Latest Member: molahs Share This Page Tweet Howtoforge - Linux Howtos and Tutorials Home Forums > ISPConfig 3 > Installation/Configuration > English | Deutsch Tutorials Tags Forums Forums Quick Links Search Forums Recent Posts Members Members Quick Links Notable Members Current Visitors Recent Activity New Profile Posts Contribute Subscribe ISPConfig News Menu Search Search titles only Posted by Member: Separate names with a comma. Newer Than: Search this thread only Search this forum only Display results as threads Useful Searches Recent Posts More... Xenforo skin by Xenfocus Contact Us Help Imprint Home Top RSS Terms and Rules Forum software by XenForo™ ©2010-2014 XenForo Ltd. Tac Anti Spam from Surrey Forum
Application AccelerationCase StudiesTestimonialsBenchmarksPartnersHosting PartnersTechnology PartnersSupport PartnersPartner ProgramSupportServicesForumWikiDocumentationDownloadsStore Log in or Sign up LiteSpeed Support Forums Forums > LiteSpeed Web Server > General > GeoIP not working? Discussion in 'General' started by 04nunhucks, Mar 30, 2011. 04nunhucks New Member Hello, I can't seem to get GeoIP working properly for use with scripts on my server. Basically, I've enabled the IP GeoLocation in LS, at server level, and provided the .dat for it. I've also enabled it at VHOST level, and added a GeoIPEnable On directive to the relevant htaccess. However, scripts cannot use https://www.howtoforge.com/community/threads/how-to-fix-this-error.51793/ functions, such as -Call to undefined function- geoip_database_info(). PHPInfo shows that _SERVER[GEOIP_*] (4 entries) and it's accurate, but I can't seem to get scripts to use the functions. Any ideas? 04nunhucks, Mar 30, 2011 #1 webizen New Member You need to add geoip support (download & install pecl geoip, load geoip.so to lsphp5 ) http://www.litespeedtech.com/support/forum/threads/geoip-not-working.4861/ to lsphp5. webizen, Mar 30, 2011 #2 04nunhucks New Member Hello webizen, how do I do this? 04nunhucks, Mar 30, 2011 #3 webizen New Member Here is the procedure: download pecl geoip from http://pecl.php.net/package/geoip wget http://pecl.php.net/get/geoip-1.0.7.tgz build geoip.so module tar zxf geoip-1.0.7.tgz cd geoip-1.0.7 /usr/local/lsws/lsphp5/bin/phpize ./configure --with-php-config=/usr/local/lsws/lsphp5/bin/php-config make make install Note: a. you need to install geoip and geoip-devel rpm if not done so (yum install GeoIP-devel). b. /usr/local/lsws/lsphp5 is the prefix of running lsphp5. add line "extension=geoip.so" to your lsphp5 php.ini file. restart lsws to make it effective. webizen, Mar 30, 2011 #4 04nunhucks New Member Thanks webizen! 04nunhucks, Mar 30, 2011 #5 04nunhucks New Member Webizen, when I try to use some functions, as in the code below, PHP: php Unfortunately there doesn't seem to be any way to update the GeoIP.dat file automatically with more up to date IP address mapping so this post shows how it can be done manually, and provides a BASH script http://www.electrictoolbox.com/update-geoip-dat-debian-5/ for automation. Manually updating the GeoIP.dat file on Debian 5 It's important to keep the data file up to date as directories get updated etc in order to keep as accurate as possible. On Debian 5 the file is located at /usr/share/GeoIP/GeoIP.dat The most up to date version of the file is currently located at http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz Note that this is the current location of the file at the time of posting this article and may be subject to relocation at error opening a later time. Change to the /tmp directory and use wget or something similar to download the file: cd /tmp wget -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz Then decompress it: gzip -d GeoIP.dat.gz and assuming it downloaded OK and decompressed OK then overwrite the existing file: mv -f GeoIP.dat /usr/share/GeoIP/GeoIP.dat That's it - you now have an up to date GeoIP.dat file. At this stage it's a really good idea to check it works as expected. Ideally you should test this out on a non-production error opening file server first just to be on the safe side. BASH script The following BASH script downloads the file using wget. If the was an issue downloading it there won't be a file at /tmp hence the if [ -f ] check. If it downloaded then it's decompressed, the old file is deleted and the new one moved where the old one was. In my original script I didn't have the "rm -f" line but despite the -f flag for the mv command the root aliases made it prompt anyway to see if I really did want to delete the file. Not much use for an automated cron script... cd /tmp wget -q http://geolite.maxmind.com/download/geoip/database/GeoLiteCountry/GeoIP.dat.gz if [ -f GeoIP.dat.gz ] then gzip -d GeoIP.dat.gz rm -f /usr/share/GeoIP/GeoIP.dat mv -f GeoIP.dat /usr/share/GeoIP/GeoIP.dat else echo "The GeoIP library could not be downloaded and updated" fi Disclaimer There isn't a large amount of error checking in the above script and you could still potentially end up without a GeoIP.dat file at the end of the process. I would recommend either running this manually every now and again and making sure everything worked OK (which is what I do myself), or modifying the tests to make them a little more robust. If there is a better way... If there is a better way to update the GeoIP.dat file on Debian please let me know and I will update this post. I couldn't see any way
if(geoip_db_avail(GEOIP_CITY_EDITION_REV1))
printgeoip_database_info(GEOIP_CITY_EDITION_REV1)."
";
$record=