Upgraded to unavailable PHP - How to downgrade?

I elected to automatically upgrade Piwik as the option was offered on the dashboard, but having upgraded I get an error message saying Piwik requires PHP version 5.5.9 and my webserver is using PHP version 5.4.43.

As I am on a shared host I do not have any control over the PHP version, and now can no longer access my analytics. This is a very serious problem. How do I

a) Restore access to my analytics, presumably by downgrading the Piwik version?

b) Prevent this occurring again? Does Piwik not check for PHP versions before upgrading? This seems to be trivial and obvious?

Many thanks for any help received.

To downgrade you can download 2.17.x from here: http://builds.piwik.org/

Thanks. Do I literally just copy the files over the existing install?

Hi Matthieu - to clarify, do I just need to copy the files over to restore the earlier version, or are there additional steps?

Interesting – an older version allowed the update despite an old PHP version which broke the install. Now that I downgraded to 2.17.1 it’s not allowing the update.

@stml Luckily downgrading is really easy.

  • Downloaded the file: http://builds.piwik.org/piwik-2.17.1.tar.gz
  • Moved old Piwik to a backup location and unpacked the fresh Piwik to replace the old one
  • Copied over the old config: cp oldpiwik/config/config.ini.php piwik/config/config.ini.php
  • Copied over geolocation file: cp oldpiwik/misc/GeoIPCity.dat piwik/misc/

Piwik should create the tmp/cache directory by itself on first load, and you are done.

This just happened to me too. I upgraded from 3.14.0 to 3.14.1 - a minor release with bug fixes only.

Now, it’s given me a great error:

An error occurred

To run Matomo you need at least PHP version 7.2.5

Unfortunately it seems your webserver is using PHP version 5.6.32.

Please try to update your PHP version, Matomo is really worth it! Nowadays most web hosts support PHP 7.2.5.

It’s not that I’m not against php server upgrades, it’s that this was not mentioned in the release notes. So, now I’m stuck with analytics that won’t load. Fortunately it’s silently failing, and so our 6k+ visitors a day to our app aren’t being hindered. But this is pretty bad that such a big jump wasn’t listed in the release notes - and, that the upgrade install process didn’t stop me and tell me.

Back to the drawing board. There goes the rest of my day. :confused:

Fortunately the DB is still in-tact, so I was able to upload version 3.14.0 to a new directory, and then copy across the config files.
Once that was working, I was then able to rename both paths and it was good again, and statistic data started flowing through. Still checking if there’s any plugins we are missing ,but at least it’s capturing data again. :slight_smile:
Only thing missing was the IP2Location plugin which was a simple fix.

Hi @vr_driver,

Thankfully the PHP version check should be before any part of the actual upgrade is ran (so the database migrations), so downgrading is simple by replacing the files again as you found out.

The weird thing is: Matomo should already have exactly such a check and only ever suggest updates that are compatible with your PHP version:

If you check https://api.matomo.org/1.0/getLatestVersion/?piwik_version=3.14.1-b2&php_version=7.2.5&mysql_version=5.7.0&trigger=CoreHome&timezone=UTC

you can see that only the first one gets suggested the Matomo 4 upgrade.

If you have any additional site on what might be going wrong or can reproduce this on a test system, it would be great if you could mention that here:

Yes, this is rather interesting. At least I’m not the only one this has happened to. I’ll look in to this further tomorrow and see what I can discover.