@Findus23 opened this Issue on November 20th 2017 Member

(Sorry if this is a bit confusing, I am still not sure what causes this)
related to #12021 and #11817

After updating to 3.2.1-b1 the piwik page stays white and I get the following error on the php log

PHP Fatal error: Cannot redeclare geoip_country_code_by_name_v6() in /var/www/piwik/vendor/geoip/geoip/src/geoip.inc on line 1593

I am using GeoIP (PECL) for localization and have installed the php-geoip package on my server, which worked before the update with PHP 7.1.11.

Locally the latest 3.x-dev works without issues, so I am not sure how to reproduce it.

@Findus23 commented on November 20th 2017 Member

The more I think about it the less sure I am if php-geoip even works with php7.1.

Locally I am using debian testing and the php-geoip only contains a config for php7.0.

On the server I am using the php packages from https://packages.sury.org/php and their php-geoip
seems to contain newer versions of geoip which also seem to be working correctly on my php7.1 piwik instance (until the update)

/etc
/etc/php
/etc/php/5.6
/etc/php/5.6/mods-available
/etc/php/5.6/mods-available/geoip.ini
/etc/php/7.0
/etc/php/7.0/mods-available
/etc/php/7.0/mods-available/geoip.ini
/etc/php/7.1
/etc/php/7.1/mods-available
/etc/php/7.1/mods-available/geoip.ini
/etc/php/7.2
/etc/php/7.2/mods-available
/etc/php/7.2/mods-available/geoip.ini
/usr
/usr/lib
/usr/lib/php
/usr/lib/php/20131226
/usr/lib/php/20131226/geoip.so
/usr/lib/php/20151012
/usr/lib/php/20151012/geoip.so
/usr/lib/php/20160303
/usr/lib/php/20160303/geoip.so
/usr/lib/php/20170718
/usr/lib/php/20170718/geoip.so
@sgiehl commented on November 20th 2017 Member

could you check if libs/MaxMindGeoIP is deleted?

@sgu222e commented on November 20th 2017

I'm seeing the same issue on my dev environment.

@Findus23 commented on November 20th 2017 Member

could you check if libs/MaxMindGeoIP is deleted?

It seems to be gone (I have in the meantime rolled back to the stable piwik version)

➜  /var/www/piwik.old ls libs 
bower_components  HTML  javascript  jqplot  jquery  PiwikTracker  README.md  sparkline  upgradephp  Zend
@sgu222e commented on November 20th 2017

libs/MaxMindGeoIP exists for me

@sgiehl commented on November 20th 2017 Member

@sgu222e remove it and the error should be gone

@sgu222e commented on November 20th 2017

remove the folder and restarted apache, still getting the same error
and yes, I didn't backup before updating...

@Findus23 commented on November 20th 2017 Member

I unziped the latest build.zip to a new vhost on the same server using the same php version. After going through the setup (to a new database) and setting the geolocation to PECL I made the update to the beta version and piwik is broken again.
So in my case the issue doesn't have to do with the folder.
I wasn't sure if opcache could cause this a I have enabled it recently, but restarting php and manually clearing opcache didn't change anything

@Findus23 commented on November 20th 2017 Member

@sgu222e
As this update doesn't update the database, I think you should be able to get it working again by downloading the latest stable piwik, replacing your current folder with the content of the zip and copying your config.php and plugins over.

@sgu222e commented on November 20th 2017

I unziped the stable version over top of my existing install (backed up config and plugins), it loaded fine

@sgu222e commented on November 20th 2017

for the record, I am using the GeoIP(Php) provider, as my piwik only does intranet traffic.

@Findus23 commented on November 20th 2017 Member

I quickly commented the line in /etc/php/7.1/mods-available/geoip.ini out (extension=geoip.so) and restarted php7.1 and my new setup works.

So it is definitly related to the fact that the PECL module is enabled.
@sgu222e If you aren't using it you should be able to disable the module and circumvent this issue.

See also https://github.com/maxmind/geoip-api-php/issues/27 and https://github.com/maxmind/geoip-api-php/issues/6, which seems to indicate that this can't really be avoided as the php module and the composer autoloader try to define the same functions.

@sgu222e commented on November 20th 2017

I think it is related to having the PECL module installed, not just activated., I commented out (extension=geoip.so) in /etc/php.d/40-geoip.ini and restarted Apache, I was able to update to the latest version without an issue.
GeoIP (Php) continues to work.

@willtate commented on November 20th 2017

@sgu222e that worked for me

@mattab commented on November 20th 2017 Owner

Any idea why this error didn't occur with the libs/MaxMindGeoIP version, why was it not also redefining errors? I remember we patched some code in the past and wrapped functions around function_exists calls.

The way I see it:

  • ASAP: we need to revert and not use the composer version of geoip since it breaks for many users who also have the PECL extension
  • Proper solution/later: maybe using Geoip2 will fix this problem? #4487
@GreenReaper commented on November 24th 2017

It might be a good idea to disable this beta version as it is still breaking new upgrades. :-)

This Issue was closed on November 22nd 2017
Powered by GitHub Issue Mirror