public static function getPhpBinary()
    {
        $binary = null;
        // HHVM
        if (defined('HHVM_VERSION') === true) {
            if (($binary = getenv('PHP_BINARY')) === false) {
                $binary = PHP_BINARY;
            }

            $binary = $binary . ' --php';
        }

        if ($binary === null) {
            $possibleBinaryLocations = [
                PHP_BINDIR . DIRECTORY_SEPARATOR . 'php',
                PHP_BINDIR . DIRECTORY_SEPARATOR . 'php-cli.exe',
                PHP_BINDIR . DIRECTORY_SEPARATOR . 'php.exe',
                getenv('PHP_BINARY'),
                getenv('PHP_BIN'),
                getenv('PHPBIN'),
            ];

            foreach ($possibleBinaryLocations as $bin) {
                if (is_readable($bin)) {
                    $binary = $bin;
                    break;
                }
            }
        }

        if ($binary === null) {
            $binary = 'php';
        }

        return $binary;
    }