sugarcrm vagrant Function ssh2_connect not found, you cannot use ssh2 here

Hi All,

my code:

<?php

$host = 'sftp://x.x.x.x';
$port = 22;
$username = 'username ';
$password = 'password ;
$remoteDir = '/folder1/folder2';
$localDir ='/folder1/folder2';

if (!function_exists("ssh2_connect"))
die('Function ssh2_connect not found, you cannot use ssh2 here');


echo "<pre>".var_dump($connection)."</pre>";
exit;
if (!$connection = ssh2_connect($host, $port))
die('Unable to connect');

if (!ssh2_auth_password($connection, $username, $password))
die('Unable to authenticate.');

if (!$stream = ssh2_sftp($connection))
die('Unable to create a stream.');

if (!$dir = opendir("ssh2.sftp://{$stream}{$remoteDir}"))
die('Could not open the directory');

$files = array();
while (false !== ($file = readdir($dir)))
{
if ($file == "." || $file == "..")
continue;
$files[] = $file;
}

foreach ($files as $file)
{
echo "Copying file: $file\n";
if (!$remote = @fopen("ssh2.sftp://{$stream}/{$remoteDir}{$file}", 'r'))
{
echo "Unable to open remote file: $file\n";
continue;
}

if (!$local = @fopen($localDir . $file, 'w'))
{
echo "Unable to create local file: $file\n";
continue;
}

$read = 0;
$filesize = filesize("ssh2.sftp://{$stream}/{$remoteDir}{$file}");
while ($read < $filesize && ($buffer = fread($remote, $filesize - $read)))
{
$read += strlen($buffer);
if (fwrite($local, $buffer) === FALSE)
{
echo "Unable to write to local file: $file\n";
break;
}
}
fclose($local);
fclose($remote);
}?>

but getting below error when I excuted vagrant@vagrant:/var/www/html/sugar$ php sftp_connect.php on vagrant then error will display as "Function ssh2_connect not found, you cannot use ssh2 here"

Please help with how to enable any php extension on vagrant machine?

Thanks,

Shreya