Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.2.1-b1] Cannot redeclare geoip_country_code_by_name_v6() when PECL extention is installed #12291

Closed
Findus23 opened this issue Nov 20, 2017 · 16 comments · Fixed by #12293
Closed
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Milestone

Comments

@Findus23
Copy link
Member

Findus23 commented Nov 20, 2017

(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
Copy link
Member Author

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
Copy link
Member

sgiehl commented Nov 20, 2017

could you check if libs/MaxMindGeoIP is deleted?

@sgu222e
Copy link

sgu222e commented Nov 20, 2017

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

@Findus23
Copy link
Member Author

Findus23 commented Nov 20, 2017

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
Copy link

sgu222e commented Nov 20, 2017

libs/MaxMindGeoIP exists for me

@sgiehl
Copy link
Member

sgiehl commented Nov 20, 2017

@sgu222e remove it and the error should be gone

@sgu222e
Copy link

sgu222e commented Nov 20, 2017

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

@Findus23
Copy link
Member Author

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
Copy link
Member Author

Findus23 commented Nov 20, 2017

@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
Copy link

sgu222e commented Nov 20, 2017

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

@sgu222e
Copy link

sgu222e commented Nov 20, 2017

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

@Findus23
Copy link
Member Author

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 maxmind/geoip-api-php#27 and maxmind/geoip-api-php#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
Copy link

sgu222e commented Nov 20, 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
Copy link

@sgu222e that worked for me

@mattab
Copy link
Member

mattab commented Nov 20, 2017

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? Make geoip backend work with geoip2 #4487

@mattab mattab added Bug For errors / faults / flaws / inconsistencies etc. Regression Indicates a feature used to work in a certain way but it no longer does even though it should. labels Nov 20, 2017
@mattab mattab added this to the 3.2.1 milestone Nov 20, 2017
@mattab mattab added the not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. label Nov 20, 2017
@GreenReaper
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug For errors / faults / flaws / inconsistencies etc. not-in-changelog For issues or pull requests that should not be included in our release changelog on matomo.org. Regression Indicates a feature used to work in a certain way but it no longer does even though it should.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants