WP_CLI\Utils
get_php_binary()
Get the path to the PHP binary used when executing WP-CLI.
Environment values permit specific binaries to be indicated.
No Hooks.
Returns
String.
Usage
get_php_binary();
get_php_binary() get php binary code WP-CLI 2.13.0-alpha
function get_php_binary() {
// Phar installs always use PHP_BINARY.
if ( inside_phar() ) {
return 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;
}