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
Cannot redeclare geoip_load_shared_mem() when running together with wordfence #11817
Comments
Thanks for the report @Findus23 - the issue is that our geoip file cannot be included twice, which Wordfence has bundled the copy as well causing the error in our code. To solve this i think we need to wrap the file in a |
Hopefully a fix will be included in the next update but is there a temporary fix for this issue as I have not had any statistics for well over a month now? Thanks... |
@RobsImpSS if you are using WP-Piwik with the "PHP" connection mode, try replace it with the "HTTP" option instead? this should fix the issue |
I'm not using the WP-Piwik, just the regular version with the code inserted into the footer of WP. The reason why I do this is because I have a folder of website templates that I track and these are not created through WP. As stated above, I get the fatal error in the Administration when I click the link to do a system check or click the Geolocation link. Piwik has always worked fine but I guess recent updates by Wordfence is conflicting with Piwik. |
I don't quite understand how it is possible that wordfence influences Piwik in that way. When you load Piwik Administration screen, Wordfence/other tools shouldn't be able to affect the Piwik page rendering. Do you have some insights on why this is the case? |
I am just a regular user of Piwik and it has always worked fine until about approx. 1.5 months ago. Then all of a sudden Piwik stopped recording visits and when I clicked on the System Check link in the Administration area, I got the error. I got the same error when I clicked on the Geolocation link as well. Fatal error: Cannot redeclare geoip_load_shared_mem() (previously declared in I then deleted my database and installed a fresh copy of Piwik, but the results were the same. I then disabled Wordfence and Piwik started recording visits again. So it was obvious that there was a conflict with Wordfence and that is when I opened a help request on the Piwik forum. |
Maybe I know the cause and a possible solution: Yesterday someone in the forum had a pretty similar issue: https://forum.piwik.org/t/piwik-konflikt-mit-wordfence-via-wordpress/24888/ His host recommended him to add It seems like wordfence uses this php setting (with the help of an .user.ini php config or (if unsupported) with a .htaccess config entry) to insert a php file at the beginning of every file that gets executed (so also the piwik files), which causes this error. |
I added it to the .htaccess file located in the config folder. Is that the right location? I copied and pasted it just as you typed it and it didn't fix it. Was copying and pasting okay or was I supposed to add any other characters? |
I think the problem it that the line needs to be added to the .htaccess in the piwik root directory, as all piwik files shouldn't be prepended with wordfence code. |
The Piwik root directory does not have a .htaccess file. I added a new .htaccess file to the Piwik root with the code you supplied and it caused a 404 error. |
mattab, Have you come up with anything yet? |
Hi, |
Here is the error I got (website url redacted):
|
This shouldn't be an issue anymore as we meanwhile switched to GeoIP2. |
From https://forum.piwik.org/t/geoip-conflict-w-wordfence/24651
If piwik is using the same geoip database as the wordpress plugin "wordfence" (via the
GeoIP (Php)
location provider) the following error occurs:I am not sure why two seperate php scripts are able to interfere, but it seems like this has happened to other projects.
A simple fix seems to be similar to this one: solarissmoke/Simple-Stats@e25c459
The text was updated successfully, but these errors were encountered: