🌍 Complete GeoIP2 Test Suite PCSNET

Apache + PHP MaxMind GeoIP2 Integration Piramide Studio NET TEST FULL GeoDB Legacy

🖥️ Server Information - Piramide Studio Media Portal - Windows/Linux - HTU66 🖥 🇸🇮 🇪🇺 🎼

Client Information

IP Address: 216.73.216.142

X-Forwarded-For: Not set

User Agent: Mozilla/5.0 AppleWebKit/537.36 (KHTML, like Gecko; compatible; ClaudeBot/1.0; +c...

Server Information

Software: Apache

Access from: 216.73.216.142

Server Time: 2025-12-30 03:00:47

GeoIPLegacy Updated: 2025

🔧 Apache mod_geoip Test Apache Module

VariableDescriptionValueStatus
GEOIP_COUNTRY_CODECountry CodeUS✓ Working
GEOIP_COUNTRY_NAMECountry NameUnited States✓ Working
GEOIP_CITYCity✓ Working
GEOIP_REGIONRegion Code✓ Working
GEOIP_REGION_NAMERegion Name✓ Working
GEOIP_POSTAL_CODEPostal Code✓ Working
GEOIP_LATITUDELatitude✓ Working
GEOIP_LONGITUDELongitude✓ Working
GEOIP_TIMEZONETimezone✓ Working
GEOIP_ASNUMAS Number✓ Working
GEOIP_ORGOrganization✓ Working
✓ Apache mod_geoip is functioning correctly

🐘 PHP MaxMind DB Reader Test MaxMind DB

Database: GeoLite2-City

✓ Database found: /usr/share/GeoIP/GeoLite2-City.mmdb (60.87 MB)

Google DNS (US)

IP: 8.8.8.8

✓ Data found

Country: United States

City: Unknown

Location: 37.751, -97.822

Cloudflare DNS (US)

IP: 1.1.1.1

✓ Data found

Country: Unknown

City: Unknown

Location: ?, ?

Example Russian IP

IP: 217.69.139.200

✓ Data found

Country: Russia

City: Unknown

Location: 55.7386, 37.6068

Example Chinese IP

IP: 110.242.68.66

✓ Data found

Country: China

City: Unknown

Location: 34.7732, 113.722

PSMedia Portal IP

IP: 89.142.197.202

✓ Data found

Country: Slovenia

City: Ljubljana

Location: 46.0503, 14.5046

Your Current IP

IP: 216.73.216.142

✓ Data found

Country: United States

City: Columbus

Location: 39.9625, -83.0061


Database: GeoLite2-Country

✓ Database found: /usr/share/GeoIP/GeoLite2-Country.mmdb (9.35 MB)

Google DNS (US)

IP: 8.8.8.8

✓ Data found

Country: United States

Cloudflare DNS (US)

IP: 1.1.1.1

✓ Data found

Country: Unknown

Example Russian IP

IP: 217.69.139.200

✓ Data found

Country: Russia

Example Chinese IP

IP: 110.242.68.66

✓ Data found

Country: China

PSMedia Portal IP

IP: 89.142.197.202

✓ Data found

Country: Slovenia

Your Current IP

IP: 216.73.216.142

✓ Data found

Country: United States


Database: GeoLite2-ASN

✓ Database found: /usr/share/GeoIP/GeoIP2-ASN.mmdb (6.93 MB)

Google DNS (US)

IP: 8.8.8.8

✓ Data found

ASN: 15169

Org: Google LLC

Cloudflare DNS (US)

IP: 1.1.1.1

✓ Data found

ASN: 13335

Org: Cloudflare, Inc.

Example Russian IP

IP: 217.69.139.200

✓ Data found

ASN: 47764

Org: Mail.Ru LLC

Example Chinese IP

IP: 110.242.68.66

✓ Data found

ASN: 4837

Org: CHINA UNICOM China169 Backbone

PSMedia Portal IP

IP: 89.142.197.202

✓ Data found

ASN: 5603

Org: Telekom Slovenije, d.d.

Your Current IP

IP: 216.73.216.142

✓ Data found

ASN: 7029

Org: Windstream Communications LLC


🔍 System Configuration Check

CheckStatusDetails
Apache mod_geoip⚠ UNKNOWNCannot determine status
PHP maxminddb extension✓ PASSConfigured correctly
Composer Autoload✓ PASSConfigured correctly
GeoIP Database Directory✓ PASSConfigured correctly
GeoLite2-City Database✓ PASSConfigured correctly
GeoLite2-Country Database✓ PASSConfigured correctly
GeoLite2-ASN Database✓ PASSConfigured correctly
Write Permissions✓ PASSConfigured correctly

💡 Usage Examples + Custom Config GeoIPLegacy Full INFODownload here

Apache .htaccess Example:

# Enable GeoIP
<IfModule mod_geoip.c>
GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat
GeoIPDBFile /usr/share/GeoIP/GeoIPCity.dat
</IfModule>

# Redirect based on country
RewriteEngine On
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^CN$
RewriteRule ^(.*)$ https://chinese-site.com [R,L]

# Block specific countries
RewriteCond %{ENV:GEOIP_COUNTRY_CODE} ^(RU|KP|IR)$
RewriteRule ^(.*)$ /blocked.html [R,L]

# GeoIP LEGACI FULL

<IfModule mod_geoip.c>
# For performance reasons, it's not recommended to turn GeoIP on serverwide,
# but rather only in or blocks where it's actually
# needed.

GeoIPEnable On
GeoIPDBFile /usr/share/GeoIP/GeoIP.dat MemoryCache
GeoIPDBFile /usr/share/GeoIP/GeoIPv6.dat IndexCache
GeoIPDBFile /usr/share/GeoIP/GeoIPCity.dat Standard
GeoIPDBFile /usr/share/GeoIP/GeoIPCityv6.dat IndexCache
GeoIPDBFile /usr/share/GeoIP/GeoIPASNum.dat Standard
GeoIPDBFile /usr/share/GeoIP/GeoIPASNumv6.dat IndexCache
# MemoryCache or Standard & CheckCache & IndexCache
# Legacy Database ISP and ORG
GeoIPDBFile /usr/share/GeoIP/GeoIPISP.dat IndexCache
GeoIPDBFile /usr/share/GeoIP/GeoIPOrg.dat IndexCache
# Setup GeoIP Activation databases
GeoIPEnableUTF8 On
# GeoIPOutput Env
GeoIPOutput All
GeoIPScanProxyHeaders On
GeoIPUseLastXForwardedForIP On
GeoIPUseFirstNonPrivateXForwardedForIP On

# Country
SetEnvIf GEOIP_COUNTRY_CODE ^(.*)$ GEOIP_COUNTRY_CODE=$1
SetEnvIf GEOIP_COUNTRY_NAME ^(.*)$ GEOIP_COUNTRY_NAME=$1

# Continent
SetEnvIf GEOIP_CONTINENT_CODE ^(.*)$ GEOIP_CONTINENT_CODE=$1

# City
SetEnvIf GEOIP_CITY ^(.*)$ GEOIP_CITY=$1
SetEnvIf GEOIP_REGION ^(.*)$ GEOIP_REGION=$1
SetEnvIf GEOIP_REGION_NAME ^(.*)$ GEOIP_REGION_NAME=$1
SetEnvIf GEOIP_POSTAL_CODE ^(.*)$ GEOIP_POSTAL_CODE=$1
SetEnvIf GEOIP_LATITUDE ^(.*)$ GEOIP_LATITUDE=$1
SetEnvIf GEOIP_LONGITUDE ^(.*)$ GEOIP_LONGITUDE=$1
SetEnvIf GEOIP_DMA_CODE ^(.*)$ GEOIP_DMA_CODE=$1
SetEnvIf GEOIP_METRO_CODE ^(.*)$ GEOIP_METRO_CODE=$1
SetEnvIf GEOIP_AREA_CODE ^(.*)$ GEOIP_AREA_CODE=$1
SetEnvIf GEOIP_TIME_ZONE ^(.*)$ GEOIP_TIME_ZONE=$1

# Organization / ISP / ASN
SetEnvIf GEOIP_ORGANIZATION ^(.*)$ GEOIP_ORGANIZATION=$1
SetEnvIf GEOIP_ISP ^(.*)$ GEOIP_ISP=$1
SetEnvIf GEOIP_ASNUM ^(.*)$ GEOIP_ASNUM=$1
SetEnvIf GEOIP_ASORG ^(.*)$ GEOIP_ASORG=$1

# IP Address (captured by mod_geoip)
SetEnvIf GEOIP_ADDR ^(.*)$ GEOIP_ADDR=$1


# Setup Extra
SetEnvIf GEOIP_CITY_COUNTRY_CODE ^(.*)$ GEOIP_CITY_COUNTRY_CODE=$1
SetEnvIf GEOIP_CITY_COUNTRY_NAME ^(.*)$ GEOIP_CITY_COUNTRY_NAME=$1
SetEnvIf GEOIP_TIMEZONE ^(.*)$ GEOIP_TIMEZONE=$1
SetEnvIf GEOIP_ORG ^(.*)$ GEOIP_ORG=$1

SetEnvIf REDIRECT_GEOIP_COUNTRY_CODE ^(.*)$ REDIRECT_GEOIP_COUNTRY_CODE=$1
SetEnvIf REDIRECT_GEOIP_COUNTRY_NAME ^(.*)$ REDIRECT_GEOIP_COUNTRY_NAME=$1

########################################################################
# Example usage (optional)
########################################################################
# Header always set X-GeoIP-Country-Code "%{GEOIP_COUNTRY_CODE}e"
# Header always set X-GeoIP-City "%{GEOIP_CITY}e"
# Header always set X-GeoIP-IP "%{GEOIP_ADDR}e"
</IfModule>


########################################################################
# Example usage if you installed maxminddb Apache Module ########################################################################
<IfModule mod_maxminddb.c>
MaxMindDBEnable On

#MaxMindDBFile COUNTRY_DB /usr/local/share/GeoIP/GeoLite2-Country.mmdb
#MaxMindDBFile CITY_DB /usr/local/share/GeoIP/GeoLite2-City.mmdb

MaxMindDBFile COUNTRY_DB /usr/share/GeoIP/GeoLite2-Country.mmdb
MaxMindDBFile CITY_DB /usr/share/GeoIP/GeoLite2-City.mmdb

MaxMindDBEnv COUNTRY_CODE COUNTRY_DB/country/iso_code
MaxMindDBEnv REGION_CODE CITY_DB/subdivisions/0/iso_code

MaxMindDBNetworkEnv COUNTRY_DB COUNTRY_NETWORK
MaxMindDBNetworkEnv CITY_DB CITY_NETWORK

#MaxMindDBSetNotes On

</IfModule>

#<IfModule mod_maxminddb.c>
# MaxMindDBEnable On
# #MaxMindDBFile ASN_DB /usr/local/share/GeoIP/GeoLite2-ASN.mmdb
# MaxMindDBFile ASN_DB /usr/share/GeoIP/GeoLite2-ASN.mmdb
#
# MaxMindDBEnv MM_ASN ASN_DB/autonomous_system_number
# MaxMindDBEnv MM_ASORG ASN_DB/autonomous_system_organization
#
# MaxMindDBNetworkEnv ASN_DB ASN_DB_NETWORK
# #
#<IfModule mod_maxminddb.c>
# MaxMindDBEnable On
# ##MaxMindDBFile CITY_DB /usr/local/share/GeoIP/GeoLite2-City.mmdb
# MaxMindDBFile CITY_DB /usr/share/GeoIP/GeoLite2-City.mmdb
# MaxMindDBEnv MM_COUNTRY_CODE CITY_DB/country/iso_code
# MaxMindDBEnv MM_COUNTRY_NAME CITY_DB/country/names/en
# MaxMindDBEnv MM_CITY_NAME CITY_DB/city/names/en
# MaxMindDBEnv MM_LONGITUDE CITY_DB/location/longitude
# MaxMindDBEnv MM_LATITUDE CITY_DB/location/latitude
#
# MaxMindDBNetworkEnv CITY_DB CITY_DB_NETWORK
#</IfModule>

### Allow countries
#<Location />
#SetEnvIf GEOIP_COUNTRY_CODE SI AllowCountry
#Deny from all
#Allow from env=AllowCountry
#</Location>

### Block countries
#<Location />
# SetEnvIf GEOIP_COUNTRY_CODE IL BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE EE BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE PL BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE CN BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE ZA BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE VN BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE FM BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE CF BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE AP BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE AF BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE KP BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE KR BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE IN BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE HK BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE ID BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE TW BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE TH BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE SG BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE AL BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE GQ BlockCountry
# SetEnvIf GEOIP_COUNTRY_CODE IR BlockCountry
# Block Anonimous Proxy Servers
# SetEnvIf GEOIP_COUNTRY_CODE A1 BlockCountry
# Block Asia Pacific Region
# SetEnvIf GEOIP_COUNTRY_CODE AP BlockCountry
# Block Armed Forces America All
# SetEnvIf GEOIP_COUNTRY_CODE AA BlockCountry
# Block Armed Forces Europe All
# SetEnvIf GEOIP_COUNTRY_CODE AE BlockCountry
# Block Armed Forces Pacific All
#SetEnvIf GEOIP_COUNTRY_CODE AP BlockCountry
# Block All Oceania islands and regions UK Australian Pacific
# SetEnvIf GEOIP_COUNTRY_CODE OC BlockCountry
# Block All Statelite internet provider anonymous and public "Satellite Provider"
# SetEnvIf GEOIP_COUNTRY_CODE A2 BlockCountry
# Block All "Other Country" Anonimous and other country hiden
# SetEnvIf GEOIP_COUNTRY_CODE O1 BlockCountry
# Deny from env=BlockCountry
#</Location>

PHP Usage Example:

<?php
// Method 1: Using Apache environment variables
$country = $_SERVER['GEOIP_COUNTRY_CODE'] ?? 'Unknown';
$city = $_SERVER['GEOIP_CITY'] ?? 'Unknown';

// Method 2: Using MaxMind DB Reader
$reader = new MaxMind\Db\Reader('/usr/share/GeoIP/GeoLite2-City.mmdb');
$data = $reader->get($_SERVER['REMOTE_ADDR']);

if ($data) {
$country = $data['country']['names']['en'] ?? 'Unknown';
$city = $data['city']['names']['en'] ?? 'Unknown';
$lat = $data['location']['latitude'] ?? null;
$lon = $data['location']['longitude'] ?? null;
}

$reader->close();
?>

GeoIPLegacy:

💡 Download GeoIPLegacy Full INFODownload here

// Download new updated GeoIPLegacy example: https://pcsnet.mywire.org/ddl/ WRITE GEOIP AS KEY WORDS OR FOUND GEOIPLEGACY.ZIP AND DOWNLOAD IT.
UNPAK ALL ZIPPED DATABASE IN MAP /usr/share/GeoIP/ or IN ANY OTHER MAP YOU USE FOR GEOIP BASE MAP.
Terminal command:
cd LOCATION OF YOUR GEOIP DATABASE MUST BE SUDO SU
cd /usr/share/GeoIP/
wget https://pcsnet.mywire.org/ddl/files/GEOIPLEGACY.ZIP
unzip GEOIPLEGACY.ZIP

INSTALL AFTER YOU HAVE ALL DATABASES PLUGINS FOR GEOIP PYTHON, PERL, PHP,....
GEOIPLEGACY.ZIP IS UPDATED/CONVERTED FROM MAXMINDDB TO GEOIPLegacy ICH MONTH