Not all systems have a binary on the path for php. Systems with multiple PHP versions installed generally append the version number to the end. For example:
which php72
/usr/bin/php72
which php56
/usr/bin/php56
To work around this an option that allows the PHP version to be specified works. This could be along the lines of:
set :composer_php_version, :php72
or
set :composer_php_version, '/usr/bin/php72'
The default version would always be :php
Related issues: