You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Matomo - Siteground Incompatibility: fails to find PHP cli binary
Context
Matomo Analytics Wordpress Plugin turned out to have a problem running on SiteGround hosting.
Problem.
We have discovered that trying to use the plugin throws a couple of Critical Errors:
PHP cli Version: Your PHP cli version is not compatible with the Matomo requirements. Please upgrad e your PHP cli version, otherwise, you might have some archiving errors
MySQLi support: Your PHP cli does not load the MSQLi extension. You might have archiving problems in Matomo but also others problems in your WordPress cron tasks. You should enable this extension
Requirement.
The plugin itself requires PHP 7.2.5+ while we have PHP 7.4.33 so the PHP version was not the issue.
After doing some deep level code debug of the Matomo plugin I discovered that the module of plugin that is trying to find the PHP cli binary mistakenly finds a cgi-bin instead which does not support the cli params sent to it and Matomo can’t parse it’s output.
Expected Behavior
Current Behavior
Possible Solution
In order to fix this issue we need to swap two blocks of code in Matomo plugin wp-content/plugins/matomo/app/core/CliMulti/CliPhp.php line 43:
The reason for this is that which php command shall run first as it returns the correct path to the php binary /usr/local/bin/php while the possiblePhpPath gives a mistaken path to cgi-bin file /usr/local/php74/bin/php
Installation.
After each fresh installation of the Matomo plugin we need to perform this monkey path by changing wp-content/plugins/matomo/app/core/CliMulti/CliPhp.php at line 43 from this:
The text was updated successfully, but these errors were encountered:
esurov
added
Potential Bug
Something that might be a bug, but needs validation and confirmation it can be reproduced.
To Triage
An issue awaiting triage by a Matomo core team member
labels
Apr 20, 2023
Although changing the order of the CLI binary detection solves the issue with siteground hosting, on other providers it may be less reliable to prefer which php over PHP_BINDIR.
There is a config.ini.php setting which can be used to specify the PHP binary to use, this should allow you to force use of a particular binary without needing to change any code.
; The absolute path to a PHP binary file in case Matomo cannot detect your PHP binary. If async CLI archiving cannot be
; used on your server this may make it work. Ensure the configured PHP binary is of type CLI and not for example cgi or
; litespeed. To find out the type of interface for a PHP binary execute this command: php -r "echo php_sapi_name();"
php_binary_path = ""
Feel free to reopen this issue if there any problems using the config setting.
bx80
added
answered
For when a question was asked and we referred to forum or answered it.
and removed
Potential Bug
Something that might be a bug, but needs validation and confirmation it can be reproduced.
To Triage
An issue awaiting triage by a Matomo core team member
labels
Apr 20, 2023
Matomo - Siteground Incompatibility: fails to find PHP cli binary
Context
Matomo Analytics Wordpress Plugin turned out to have a problem running on SiteGround hosting.
Problem.
We have discovered that trying to use the plugin throws a couple of Critical Errors:
Requirement.
The plugin itself requires PHP 7.2.5+ while we have PHP 7.4.33 so the PHP version was not the issue.
Requirements for Matomo On-Premise - Analytics Platform - Matomo
Research.
After doing some deep level code debug of the Matomo plugin I discovered that the module of plugin that is trying to find the PHP cli binary mistakenly finds a cgi-bin instead which does not support the cli params sent to it and Matomo can’t parse it’s output.
Expected Behavior
Current Behavior
Possible Solution
In order to fix this issue we need to swap two blocks of code in Matomo plugin wp-content/plugins/matomo/app/core/CliMulti/CliPhp.php line 43:
so it should read as follows:
The reason for this is that which php command shall run first as it returns the correct path to the php binary /usr/local/bin/php while the possiblePhpPath gives a mistaken path to cgi-bin file /usr/local/php74/bin/php
Installation.
After each fresh installation of the Matomo plugin we need to perform this monkey path by changing wp-content/plugins/matomo/app/core/CliMulti/CliPhp.php at line 43 from this:
to this:
Said that, I will try to reach out to the Matomo plugin support to report the bug and offer this solution as a fix.
Steps to Reproduce (for Bugs)
Your Environment
The text was updated successfully, but these errors were encountered: