I have just installed Piwik 3.2.0 on FreeBSD 11.1. The GeoIPCity.dat file was manually downloaded to the misc folder. Upon refreshing the page I got this error:
Piwik encoutered an error: Call to undefined function Piwik\Plugins\UserCountry\LocationProvider\GeoIp\filter_var() (which lead to: An exception has been thrown during the compilation of a template (“Error in PHP GeoIP provider: Twig Test “divisibleby” is deprecated since version 1.21. Use “divisible by” instead in /…/analytics/piwik/plugins/CorePluginsAdmin/templates/safemode.twig at line 78. on line 652 of /…/analytics/piwik/vendor/twig/twig/lib/Twig/ExpressionParser.php”) in “@CorePluginsAdmin/safemode.twig”.)
Has anybody seen this type of error? Do you know how to fix it?
This seems like a real bug, or rather two bugs (Call to undefined function Piwik\Plugins\UserCountry\LocationProvider\GeoIp\filter_var() and when trying to display the error page an twig error occured: Error in PHP GeoIP provider: Twig Test “divisibleby” is deprecated since version 1.21. Use “divisible by” instead in /…/analytics/piwik/plugins/CorePluginsAdmin/templates/safemode.twig at line 78. on line 652 of /…/analytics/piwik/vendor/twig/twig/lib/Twig/ExpressionParser.php”) in “@CorePluginsAdmin/safemode.twig”.)
Piwik was installed manually using piwik.zip. After reading the documentation and much tinkering I was able to get Piwik to display the Geolocation page without the ‘Twig’ error. The error was most probably caused by a misconfiguration of the httpd.conf and php.ini files.
Anyway, GeoIP (PECL) is still not working … has a ‘BROKEN’ status due to the fact that the PECL module thinks that GeoIPCity.dat is a directory not a file. At least that’s what I understand from the Error output.
Error: The PECL module is looking for databases in ‘/usr/home/…/analytics/piwik/misc/GeoIPCity.dat/’, but this directory does not exist. Please create it and add the GeoIP databases to it. Alternatively, you can set ‘geoip.custom_directory’ to the correct directory in your php.ini file.
Note: The ‘geoip.custom_directory’ PHP ini option is set to ‘/usr/home/…/analytics/piwik/misc/GeoIPCity.dat’.
If you have any ideas how to fix this, please let me know. I’ve runout of ideas
I haven’t looked any further into your issue, but I’m pretty sure that the geoip.custom_directory only needs the directory and not the GeoIPCity file. (/usr/home/…/analytics/piwik/misc/)