This usually caused by the database not downloading correctly.
If you can check the fi size, it will be in wordpress/wp-content/plugins/wp-stastics/GeoIp2-db.
It should be about 1.6meg.
Thread Starter
VDR-PL
(@vdr-pl)
I try it and get manually by wget but without results :/
Actually I have:
-rw-rw-rw- 1603543 Dec 10 01:52 GeoLite2-Country.mmdb
md5 sum:
MD5 (GeoLite2-Country.mmdb) = 7741311611c8da3568a6a71ef26b7c92
That’s the right size for the file so it should be working. Do you have access to any PHP error logs that might be able to shed some light on the issue?
Thread Starter
VDR-PL
(@vdr-pl)
Yeap, i see that script try select from statistics_visitor but in MySQL is a wp_statistics_visitor:
WordPress database error Table ‘blabla.statistics_visitor’ doesn’t exist for query SELECT id,ip FROM statistics_visitor
WHERE location = ” or location = ‘000’ or location IS NULL made by do_action(‘statistics_page_wp-statistics/optimization’), call_user_func_array, wp_statistics_optimization, include_once(‘/plugins/wp-statistics/includes/optimization/optimization-geoip.php’), wp_statistics_populate_geoip_info,
PHP Fatal error: Call to undefined function MaxMind\\Db\\Reader\\bcadd() in /usr/home/morskie/www/wp-content/plugins/wp-statistics/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php on line 252,
In databases blabla SELECT * FROM wp_statistics_visitor
:
Showing rows 0 – 21 (22 total)
Thread Starter
VDR-PL
(@vdr-pl)
I added BC Math extensions to php so bcadd function is actually available 😉 but still is problem with {$table_prefix}statistics_visitor
I changed manually at geoip-populate.php to wp_statistics_visitor
but this generated other errors with table_prefix:
WordPress database error Table ‘morskie.statistics_visitor’ doesn’t exist for query UPDATE statistics_visitor
SET location
= ‘PL’ WHERE id
= ‘1’ made by do_action(‘statistics_page_wp-statistics/optimization’), call_user_func_array, wp_statistics_optimization, include_once(‘/plugins/wp-statistics/includes/optimization/optimization-geoip.php’), wp_statistics_populate_geoip_info,
So problem is with {$table_prefix}statistics_visitor
edit wp-statistics/includes/functions/geoip-populate.php, change:
function wp_statistics_populate_geoip_info() {
global $wpdb;
$result = $wpdb->get_results("SELECT id,ip FROM <code>{$table_prefix}statistics_visitor</code> WHERE location = '' or location = '000' or location IS NULL");
to:
function wp_statistics_populate_geoip_info() {
global $wpdb;
$table_prefix = $wpdb->prefix;
$result = $wpdb->get_results("SELECT id,ip FROM <code>{$table_prefix}statistics_visitor</code> WHERE location = '' or location = '000' or location IS NULL");
See if that works.
Thread Starter
VDR-PL
(@vdr-pl)
After add $table_prefix = $wpdb->prefix;
all working perfectly 🙂 🙂 Thanks.