New install breaks site

Using Matomo 3.3.0 with MediaWiki 1.30.0.

The site has been running ok with MW for a week or so.

Yesterday I installed Matomo. Everything seemed to go perfectly well during installation and configuration, all requirements were fulfilled and I don’t believe any step was omitted.

However, after uploading LocalSettings.php with the relevant lines added, MW ceased functioning altogether. Looking at the source coming back to the browser, there’s just “1” in the top left corner.

I used these lines:
wfLoadExtension( ‘Piwik’ );
$wgPiwikURL = “Sign in - Matomo”;
$wgPiwikIDSite = “1”;

When I comment them out, MW works as it should.

Any suggestions?

That sounds like a possible PHP error with the MW plugin: Extension:Piwik Integration - MediaWiki

Could you check your php error log for any relevant lines?

Thanks but I can’t find a php error log.

php --info gives error_log as no value and log_errors as Off.

Edit: The extension adds the tracking code to the bottom of the page, but I’m getting nothing but “1” coming back, could that be significant?

Adding the tracking code to the bottom of the site is normal behaviour.

I’m pretty sure this is not a problem with matomo, but with the plugin. Could you ask for help there: Issues · DaSchTour/piwik-mediawiki-extension · GitHub

Thanks again. I just remembered seeing an alternative method somewhere, which involves putting the code on a Special MW page. I’ll try that first then go to the github forum.

1 Like

It looks like that worked. I’m crossing my fingers!

OK, I tried putting the tracking code in MW:Common.js but couldn’t get that to work either so went back to using the Piwik extension, but this time with PHP error reporting, which showed this:

Fatal error: Uncaught Exception: /home/cardanowkm/www/w/extensions/Piwik/extension.json does not exist! in /home/cardanowkm/www/w/includes/registration/ExtensionRegistry.php:99 Stack trace: #0 /home/cardanowkm/www/w/includes/GlobalFunctions.php(120): ExtensionRegistry->queue(’/home/cardanowk…’) #1 /home/cardanowkm/www/w/LocalSettings.php(212): wfLoadExtension(‘Piwik’) #2 /home/cardanowkm/www/w/includes/WebStart.php(102): require_once(’/home/cardanowk…’) #3 /home/cardanowkm/www/w/index.php(40): require(’/home/cardanowk…’) #4 {main} thrown in /home/cardanowkm/www/w/includes/registration/ExtensionRegistry.php on line 99

I’ve searched and can’t find extension.json. Any suggestions?

Yes, follow the instructions.

From: GitHub - DaSchTour/piwik-mediawiki-extension

Installation instructions

Please, read them carefully. They’re not very difficult to understand,
but ALL steps are necessary:

  1. Create a folder called “Piwik” in your extensions directory

  2. Upload extension.json and Piwik.hooks.php in the “Piwik” folder you’ve just created

  3. Edit your LocalSettings.php and, at the end of the file, add the

    wfLoadExtension( ‘Piwik’ );

  4. Configure the Piwik URL and site-id. To do so; edit the LocalSettings and set up the following variables:

    $wgPiwikURL = “piwik-host.tld/dir/”;

    $wgPiwikIDSite = “piwik_idsite”;

    IMPORTANT Do not define the protocol of the $wgPiwikURL

Note: Change the value of $wgPiwikURL with the URL, without the protocol
but including the domain name, where you installed Piwik.
Remember to add the trailing slash!

  1. Enjoy our extension!

Thanks very much.

The Piwik package I downloaded does not include the files mentioned in step 2, and the instructions I followed just said upload the unzipped files.

So I found the files and uploaded them and it’s now working properly.

Thanks again!

Sorry, I spoke too soon. These files, extension.json and Piwik.hooks.php, are now being flagged up as problematic in the System Check.

The first one, at least, appears necessary, as its absence breaks the site. But it was missing from the package I downloaded, and is now being complained about.

What gives?

Can not help you on this, please consult the MW support.

Sorry I did not explain clearly enough, this is a Matomo issue, not a MW one.

Following the Matomo installation, a PHP error occurred, saying Piwik/extension.json does not exist. Following advice given here I found and uploaded that file, along with another, which were missing from the Matomo package I originally downloaded. That fixed the problem, and all is now well, except only that the Matomo System Check page has a problem with these files, saying

Files were found in your Matomo but we didn’t expect them.
–> Please delete these files to prevent errors. <–

File to delete: extension.json
File to delete: Piwik.hooks.php

OK, I just realised, there must be two packages, to be installed in different places, the MW extension and the main Matomo program. But I saw no indication of that anywhere! This is all very confusing.

Why did you put these 2 files into your Matomo folder? The belong to MW and have nothing to do at all with Matomo.

The 2 files would have to be at /var/www/mediawiki/extensions/Piwik/ for my setup.

In the current situation I’m not really sure what you installed where, maybe would be best if someone like @Lukas would look at your server directly, if you are willing to give a Matomo Member credentials for that.

So the files and the instructions on using them come from Matomo sources and they go into a Piwik folder but they have nothing to do with Matomo…

I hope you can understand my confusion.

But as I said, I now realise that the MW extension and the Matomo program are two entirely distinct things that should be installed in different places.

I’m not really sure what you installed where

Very simple: everything is in the MW extension folder.

I’m no longer looking for assistance – I assume the System Check report is ignorable – I just wanted to point out that my mistake is one that’s quite easily made, given the documentation, for someone who knows nothing of Matomo and very little of MW.