Update 23.08.2025 /php
- [RGK]*Kent
- Posts: 23
- Joined: Sat 28. Oct 2023, 09:55
- Location: Bucharest/Romania
- Contact:
Update 23.08.2025 /php
On 28.08.2025 the panel was updated, from which the optional php versions were also updated, ex php5.6.40. I use sites with functions that use geoip. After the update my sites no longer identify geoip/ip. Can you help me with a solution to fix it?
Thank you,
Liviu-Marian
Re: Update 23.08.2025 /php
you must activate GeoIP again, since modules that are not included in the Keyhelp PHP versions are not active anymore after the update.
You can disable the auto-update function for this PHP versions so that your changes are not overwritten
Florian Cheno
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
- [RGK]*Kent
- Posts: 23
- Joined: Sat 28. Oct 2023, 09:55
- Location: Bucharest/Romania
- Contact:
Re: Update 23.08.2025 /php
Re: Update 23.08.2025 /php
Florian Cheno
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
- [RGK]*Kent
- Posts: 23
- Joined: Sat 28. Oct 2023, 09:55
- Location: Bucharest/Romania
- Contact:
Re: Update 23.08.2025 /php
Re: Update 23.08.2025 /php
Florian Cheno
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
- [RGK]*Kent
- Posts: 23
- Joined: Sat 28. Oct 2023, 09:55
- Location: Bucharest/Romania
- Contact:
Re: Update 23.08.2025 /php
' . after a more detailed check I did this:PHP message: PHP Fatal error: Unknown: Failed opening required '/opt/keyhelp/php/5.6/overrides/geoip_compat.php' (include_path='.:/opt/keyhelp/php/5.6/lib/php') in Unknown on line 0
Code: Select all
sudo mkdir -p /opt/keyhelp/php/5.6/overrides
sudo tee /opt/keyhelp/php/5.6/overrides/geoip_compat.php > /dev/null <<'PHP'
<?php
// geoip_compat.php - compatibility shim for geoip_* functions
// Path: /opt/keyhelp/php/5.6/overrides/geoip_compat.php
// Optional: change path to your mmdb file if using GeoIP2
$GEOIP2_MMDB_PATH = '/usr/share/GeoIP/GeoLite2-Country.mmdb';
// If native geoip extension exists, do nothing (native functions already present)
if (extension_loaded('geoip')) {
return;
}
// Try to wire old geoip_* names to MaxMind DB via geoip2 library if available
if (file_exists(__DIR__ . '/vendor/autoload.php')) {
require_once __DIR__ . '/vendor/autoload.php';
}
// also allow composer installed in project/vendor or global /opt/keyhelp/php/5.6/lib/php/vendor
if (!class_exists('\\GeoIp2\\Database\\Reader') && file_exists('/opt/keyhelp/php/5.6/lib/php/vendor/autoload.php')) {
require_once '/opt/keyhelp/php/5.6/lib/php/vendor/autoload.php';
}
// wrapper function factory
if (!function_exists('geoip_country_code_by_name')) {
function geoip_country_code_by_name($ip) {
global $GEOIP2_MMDB_PATH;
// 1) If geoip extension exists now (just in case), call it
if (function_exists('geoip_country_code_by_name')) {
return \geoip_country_code_by_name($ip);
}
// 2) Try GeoIP2 Reader if available
if (class_exists('\\GeoIp2\\Database\\Reader')) {
try {
$reader = new \GeoIp2\Database\Reader($GEOIP2_MMDB_PATH);
$record = $reader->country($ip);
return $record->country->isoCode ?: false;
} catch (\Throwable $e) {
// fail silently and fall through to false
return false;
}
}
// 3) fallback: try simple local /usr/share/GeoIP/GeoIP.dat via ext if installed (not likely)
if (function_exists('geoip_country_code_by_name')) {
return \geoip_country_code_by_name($ip);
}
// 4) nothing available
return false;
}
}
// define other convenience functions commonly used
if (!function_exists('geoip_country_name_by_name')) {
function geoip_country_name_by_name($ip) {
if (function_exists('geoip_country_name_by_name')) {
return \geoip_country_name_by_name($ip);
}
if (class_exists('\\GeoIp2\\Database\\Reader')) {
global $GEOIP2_MMDB_PATH;
try {
$reader = new \GeoIp2\Database\Reader($GEOIP2_MMDB_PATH);
$record = $reader->country($ip);
return $record->country->name ?: false;
} catch (\Throwable $e) {
return false;
}
}
return false;
}
}
PHP
sudo chown root:root /opt/keyhelp/php/5.6/overrides/geoip_compat.php
sudo chmod 644 /opt/keyhelp/php/5.6/overrides/geoip_compat.php
Thank you
Re: Update 23.08.2025 /php
I am not sure what else to add here. As Florian already mentioned, GeoIP is not included in the additional PHP interpreter, it never has been.
If you’ve used it in the past, then you (or someone else) must have compiled and configured it manually on your server.
To get it working again, you’ll need to compile the extension yourself. Afterwards, I recommend disabling the auto-update under Configuration -> PHP Interpreters for any PHP versions where you’ve added the GeoIP extension. Otherwise, it might get overridden again in the future, just like now.
If compiling it yourself isn’t an option, we also offer paid support:
https://www.keyweb.de/en/keyhelp/suppor ... lp-support
Alexander Mahr
**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************