We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 25273
    • 13 Posts
    I am trying to integrate Geolite Country from MaxMind into our modx installation.

    I have a small php routine in a snippet. I am getting this error when the snippet runs:

    « MODx Parse Error »
    MODx encountered the following error while attempting to parse the requested resource:
    « PHP Parse Error »

    PHP error debug
    Error: require_once() [function.require-once]: URL file-access is disabled in the server configuration
    Error type/ Nr.: Warning - 2
    File: /home/public_html/manager/includes/document.parser.class.inc.php(770) : eval()’d code
    Line: 1

    I guess this is a problem with our configuration, but not being a modx guru I cannot work out what needs changing and where.
    Can anyone point me in the correct direction?

    Thank you for reading this question.


    Snippet is:


    $gi = geoip_open("http://www.domain.com/GeoIP.dat",GEOIP_STANDARD);

    $country_code = geoip_country_code_by_addr($gi, $_SERVER[’REMOTE_ADDR’]);
    $country_name = geoip_country_name_by_addr($gi, $_SERVER[’REMOTE_ADDR’]);


    switch ($country_code){
    case "":
    ?>UNKONWN !!!
    echo $country_name;


    Our setup:
    MODx version 1.0.3
    Version codename rev 6653
    phpInfo() View
    Access permissions Enabled
    Server Time 12:46:32
    Local Time 12:46:32
    Server offset 0 h
    Database name domain_com_modx
    Database server
    Database Version 5.0.92-community-log
    Database Charset latin1
    Database Collation Charset latin1_swedish_ci
    Table prefix modx_
    MODX_BASE_PATH /home/public_html/
    MODX_MANAGER_URL http://www.domain.com/manager/
    MODX_MANAGER_PATH /home/public_html/manager/
    MODX_SITE_URL http://www.domain.com/

      • 9342
      • 50 Posts

      Any luck that you get this work? I'd like to use GeoIP on my site too but not so sure how to start. Please advise.
      • That error is saying that you can't "include" or "require" a file via a URL, like http://domain.com/file.php

        You need to use a file path, not a URL. Paths will be relative to your index.php file, so if you have the geoip.inc file in the web root, it would just be

        I don't know if the goip_open function would have the same problem, but if it did then the solution would be the same - file path, not URL.
          Studying MODX in the desert - http://sottwell.com
          Tips and Tricks from the MODX Forums and Slack Channels - http://modxcookbook.com
          Join the Slack Community - http://modx.org