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

Automated updater doesn't check PHP version #17088

Open
waldoj opened this issue Jan 13, 2021 · 8 comments
Open

Automated updater doesn't check PHP version #17088

waldoj opened this issue Jan 13, 2021 · 8 comments
Labels
Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data

Comments

@waldoj
Copy link

waldoj commented Jan 13, 2021

I just used the automated update script for my Matomo installation. It cheerfully ran the update, and now Matomo doesn't work, because it requires PHP 7 and this server uses PHP 5, for legacy reasons.

Requiring PHP 7 is good and right, but the updater needs to verify that the environment is compatible before upgrading.

@tsteur
Copy link
Member

tsteur commented Jan 14, 2021

Hi @waldoj thanks for creating this issue. This should actually already be happening. Do you remember on which version of Matomo you were?

@waldoj
Copy link
Author

waldoj commented Jan 14, 2021

I'm afraid that I'm not sure. Because Matomo (last I checked) can't be scripted to be part of a deploy process, due to the manual config steps, it's not subject to my normal version-control system. I suspect strongly that I last updated it in the summer, probably around July, so perhaps v3.14 or thereabouts.

Should I wind up restoring from a backup, I'll be sure to report back with the exact version.

@tsteur
Copy link
Member

tsteur commented Jan 14, 2021

Be great to report back if you end up restoring. Any chance you know your exact PHP version?

So far https://api.matomo.org/1.0/getLatestVersion/?piwik_version=3.14.1-b2&php_version=5.7.5&release_channel=latest suggests the latest version is a 3.14.1 . Also for release_channel=latest_stable and when no release channel is set etc.

Looking at the code the only way this would happen is if Matomo was not able to detect the PHP version at all for some reason. We're using PHP_VERSION constant which I think cannot be disabled (or maybe it can in PHP not sure)

@waldoj
Copy link
Author

waldoj commented Jan 14, 2021

Sure thing, I'm using v5.6.40-39. I've verified that both phpversion() and PHP_VERSION function properly on my server. (It's a stock Ubuntu 18 installation on an EC2 instance.) Now, it's been at least a decade since I've had cause to use a PHP version string, but I was surprised to find that both of the methods of displaying the version didn't display 5.6.40-39, but instead 5.6.40-39+ubuntu18.04.1+deb.sury.org+1. But maybe y'all expect PHP version numbers to be a hot mess, and parse out the actual identifier?

@waldoj
Copy link
Author

waldoj commented Jan 14, 2021

FWIW, Matomo also reports the unwieldy version name when trying to load any page, I've just noticed:

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.40-39+ubuntu18.04.1+deb.sury.org+1.

The error isn't wrong, but it hints that perhaps the installer isn't extracting the actual version number from that bizarre string that PHP is generating. (Or there's also the distinct possibility that I'm barking up the wrong tree here.)

@tsteur
Copy link
Member

tsteur commented Jan 14, 2021

Thanks @waldoj just debugged/tested the logic for the update check when the exact PHP version is used that you mentioned and it should have still suggested 3.X. I double checked using the debugger. We're using PHP's internal version_compare method and it seems to be able to handle those sort of strings. So right now I can't really explain how this could possibly happen and we haven't heard of any other case like this so I'm tempted to just leave the issue open for now and we see if it ever happens again. If you otherwise backport, and it suggests to upgrade to Matomo 4 again, then it might be interesting to do a few checks.

@tsteur tsteur added the Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data label Jan 14, 2021
@waldoj
Copy link
Author

waldoj commented Jan 14, 2021

If you can't reproduce it, there's nothing to be done. 🤷 If I can reproduce this, I'm happy to return and document further.

@MatomoForumNotifications

This issue has been mentioned on Matomo forums. There might be relevant details there:

https://forum.matomo.org/t/upgraded-to-unavailable-php-how-to-downgrade/22712/10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Can't reproduce (yet) For issues that are reported by several people, but can't be reproduced reliably and need more data
Projects
None yet
Development

No branches or pull requests

4 participants