The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Required database not available at /usr/share/GeoIP.dat

Discussion in 'EasyApache' started by bloatedstoat, Jun 27, 2016.

  1. bloatedstoat

    bloatedstoat Well-Known Member

    Joined:
    Jun 14, 2012
    Messages:
    78
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Victoria, Australia
    cPanel Access Level:
    Root Administrator
    Hello,

    I'm getting this error when calling geoip_country_code_by_name()

    Severity: Warning --> geoip_country_code_by_name(): Required database not available at /usr/share/GeoIP/GeoIP.dat. /path/to/script

    The database is present though:
    [root@server]# ls -al /usr/share/GeoIP/
    lrwxrwxrwx 1 root root 18 May 15 2015 GeoIP.dat -> GeoLiteCountry.dat
    -rw-r--r-- 1 root root 868037 Apr 6 18:48 GeoLiteCountry.dat


    PHP Selector | extensions has the geoip checkbox checked for PHP5.6 within cpanel for the account.

    The module is available:
    ls -al /usr/local/apache/modules/
    mod_geoip.so


    I thought it might be because:
    LoadModule geoip_module /usr/local/apache/modules/mod_geoip.so
    GeoIPEnable On
    GeoIPDBFile /usr/share/GeoIP/GeoIP.dat MemoryCache


    was missing from

    WHM -> Service Configuration -> Apache Configuration -> Include Editor -> Pre Main Include -> Select the current Apache version

    So I added it and restarted Apache but this had made no difference at all.

    This was working fine until recently so I'm trying to fathom out what's happened and where. So far I've made no progress hence I'm here hoping to get some advice.

    Anybody have any suggestions?

    CLOUDLINUX 6.
    WHM 56.0 (build 24)

    Thank you!
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello,

    You can run the following command to determine if the required libGeoIP library is installed on your system:

    Code:
    rpm -qa|grep GeoIP
    The output should resemble this:

    Code:
    rpm -qa|grep GeoIP
    GeoIP-devel-1.5.0-9.el7.x86_64
    GeoIP-1.5.0-9.el7.x86_64
    If it doesn't, you may need to install the "geoip" and "geoip-devel" packages via your system package manager (YUM).

    Thank you.
     
  3. bloatedstoat

    bloatedstoat Well-Known Member

    Joined:
    Jun 14, 2012
    Messages:
    78
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Victoria, Australia
    cPanel Access Level:
    Root Administrator
    Hello and thanks Michael.

    This is the result of the command:
    Code:
    rpm -qa|grep GeoIP
    GeoIP-GeoLite-data-2016.04-1.el6.art.noarch
    GeoIP-devel-1.6.9-2.el6.art.x86_64
    GeoIP-GeoLite-data-extra-2016.04-1.el6.art.noarch
    GeoIP-1.6.9-2.el6.art.x86_64
    cat /etc/redhat-release
    CloudLinux Server release 6.8 (Oleg Makarov)
     
  4. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You may also want to verify if the issue persists when you copy GeoLiteCountry.dat to GeoIP.dat. This will rule out the symbolic link as the source of the problem. Otherwise, if the issue persists, feel free to open a support ticket using the link in my signature so we can take a closer look. You can post the ticket number here so we can update this thread with the outcome, and you can also review the following thread for information about ticket submission guidelines:

    [Informational] - Get the most from cPanel Support

    Thank you.
     
  5. bloatedstoat

    bloatedstoat Well-Known Member

    Joined:
    Jun 14, 2012
    Messages:
    78
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Victoria, Australia
    cPanel Access Level:
    Root Administrator
    @cPanelMichael thank you!

    I moved GeoIP.dat to _GeoIP.dat and copied GeoLiteCountry.dat to GeoIP.dat as suggested.
    It now works as hoped for so appreciate the help.

    Do you have any clues as to why the symbolic link would cause the problem from the information I have given?

    Thanks again. :)
     
  6. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    You mentioned using CloudLinux. Are you using the "SecureLinks" functionality? If so, that might relate to the problem you encountered. The feature is documented at:

    Kernel Settings > SecureLinks

    Thank you.
     
  7. bloatedstoat

    bloatedstoat Well-Known Member

    Joined:
    Jun 14, 2012
    Messages:
    78
    Likes Received:
    6
    Trophy Points:
    8
    Location:
    Victoria, Australia
    cPanel Access Level:
    Root Administrator
    For anyone else who comes across this thread experiencing the same thing as outlined above and you are using CloudLinux with CageFS - here is the remedy:

    Create the GeoIP.cfg file.
    vi /etc/cagefs/conf.d/GeoIP.cfg

    Add to the file the following snippet:

    Code:
    [geoip]
    comment=GeoIP
    paths=/usr/share/GeoIP/GeoIP.dat
    Run:
    cagefsctl --force-update from the command line.

    Job done.

    Thanks to Anton Mashnin over at CloudLinux support for this.
     
    cPanelMichael likes this.
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
Loading...

Share This Page