This commit corrects a previous unseen issue where the PHP environment at command line level is being populated with environment variables normally only seen when called from a web server.
issue#2304: Installation progress stays at 0%
issue#2311: Unable to update PHP location during installation due to incorrect CLI environment
The new check uses the php_sapi_name() function to verify that we are indeed at 'cli' level. All other values returned by php_sapi_name are considered non-cli including 'cli-server' which is for client/server scenarios.
Most checks have now been replaced by a single defintion ('CACTI_CLI') to define whether in CLI mode. If a script is only to be called from CLI it must either defined 'CACTI_CLI_ONLY' or include include/cli_check.php instead of include/global.php.