@tsteur opened this Pull Request on December 18th 2019 Member

replaces https://github.com/matomo-org/matomo/pull/15283

Noticed the user's instance was using listespeed https://www.php.net/manual/en/install.unix.litespeed.php which returned following

phpbinary: /usr/local/bin/lsphp
phpbindir: /opt/alt/php72/usr/bin
which php: /usr/local/bin/php

We would have used lsphp but this seems to print the hashbang and have other issues. see #15283

@skizzerz commented on February 22nd 2020

This change broke archiving on my matomo instance, because the path to my cli version of php is /usr/local/lsws/lsphp72/bin/php.

You really shouldn't be trying to guess what flavor of PHP is being used by testing what strings appear in the path. Instead, run /path/to/php -v and check that output. If it starts with PHP <version> (cli) then you're good to go. If it says anything else (such as PHP <version> (cgi) or PHP <version> (litespeed)) then it's the wrong binary.

For a common-case fast-path, you can run php_sapi_name() directly in the PHP_BINARY branch to see if the currently-running PHP is cli or not. If it is, you can use that without needing to call to shell_exec (which may be important for some customers that have the function disabled).

@tsteur commented on February 23rd 2020 Member
This Pull Request was closed on December 22nd 2019
Powered by GitHub Issue Mirror