Update 23.08.2025 /php

General discussions around KeyHelp.
Post Reply
User avatar
[RGK]*Kent
Posts: 23
Joined: Sat 28. Oct 2023, 09:55
Location: Bucharest/Romania
Contact:

Update 23.08.2025 /php

Post by [RGK]*Kent »

Hello,

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
User avatar
Florian
Keyweb AG
Posts: 1763
Joined: Wed 20. Jan 2016, 02:28

Re: Update 23.08.2025 /php

Post by Florian »

Hello,

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
Mit freundlichen Grüßen / Best regards
Florian Cheno

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
[RGK]*Kent
Posts: 23
Joined: Sat 28. Oct 2023, 09:55
Location: Bucharest/Romania
Contact:

Re: Update 23.08.2025 /php

Post by [RGK]*Kent »

Can you help me a little to update and activate the geoip function? I'm not really good at doing this. I'm grateful.
User avatar
Florian
Keyweb AG
Posts: 1763
Joined: Wed 20. Jan 2016, 02:28

Re: Update 23.08.2025 /php

Post by Florian »

How did you do it the first time? You must repeat these steps.
Mit freundlichen Grüßen / Best regards
Florian Cheno

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
[RGK]*Kent
Posts: 23
Joined: Sat 28. Oct 2023, 09:55
Location: Bucharest/Romania
Contact:

Re: Update 23.08.2025 /php

Post by [RGK]*Kent »

keyhelp has updated to the latest version and I think this has disabled geoip from php 5.6. I hope I get some help. and a recommendation for the future update of keyhelp to reactivate geoip for all php versions. thanks
User avatar
Florian
Keyweb AG
Posts: 1763
Joined: Wed 20. Jan 2016, 02:28

Re: Update 23.08.2025 /php

Post by Florian »

Yes but GeoIP is not included in the Keyhelp PHP versions, so you must installed it by yourself for the first time. Simply do the same again
Mit freundlichen Grüßen / Best regards
Florian Cheno

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
[RGK]*Kent
Posts: 23
Joined: Sat 28. Oct 2023, 09:55
Location: Bucharest/Romania
Contact:

Re: Update 23.08.2025 /php

Post by [RGK]*Kent »

it is a major problem. i have reinstalled the operating system and keyhelp, including all available php versions. on php 5.6 where i use two sites with geoip, the result in log.errors is:
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
' . after a more detailed check I did this:

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
. after all that I want to say that since keyhelp updated no ip on my site indicates country anymore. please check and resolve the errors for these functions.
Thank you
User avatar
Alexander
Keyweb AG
Posts: 4589
Joined: Wed 20. Jan 2016, 02:23

Re: Update 23.08.2025 /php

Post by Alexander »

Hello,

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
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
Post Reply