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
This change broke archiving on my matomo instance, because the path to my cli version of php is
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).