WP_CLI\Utils

get_php_binary()WP-CLI 1.0

Get the path to the PHP binary used when executing WP-CLI.

Environment values permit specific binaries to be indicated.

No Hooks.

Return

String.

Usage

get_php_binary();

Code of get_php_binary() WP-CLI 2.7.0-alpha

function get_php_binary() {
	$wp_cli_php_used = getenv( 'WP_CLI_PHP_USED' );
	if ( false !== $wp_cli_php_used ) {
		return $wp_cli_php_used;
	}

	$wp_cli_php = getenv( 'WP_CLI_PHP' );
	if ( false !== $wp_cli_php ) {
		return $wp_cli_php;
	}

	return PHP_BINARY;
}