Error about geoip_open on all pages when logged out
-
Just installed and getting the following message on all pages (admin and frontend):
Fatal error: Call to undefined function geoip_open() in /path/to/wp-content/plugins/wp-power-stats/powerStats.class.php on line 287
In the end I got around it by commenting out all the define calls at the top of geoip.inc and then forcing powerStats.class.php to include it without checking if GEOIP_COUNTRY_EDITION was set – which implies it’s being set by something else.
Turned out the GeoIP PHP extension was installed server-side. So I modified set_country to the following, seems to work:
protected function set_country() { if (!function_exists('geoip_country_code_by_name')) { require_once(WP_POWER_STATS_PLUGIN_DIR . '/vendor/geoip/geoip.inc'); if (function_exists('geoip_open')) { $gi = geoip_open(WP_POWER_STATS_PLUGIN_DIR . '/vendor/geoip/GeoIP.dat', GEOIP_STANDARD); $this->country = geoip_country_code_by_addr($gi, $this->get_ip()); geoip_close($gi); } } else { $this->country = geoip_country_code_by_name($this->get_ip()); } }
That allowed me to uncomment the stuff in the geoip.inc file
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Error about geoip_open on all pages when logged out’ is closed to new replies.