Using putty I can able to connect. But using PHP I can't. I don't know ,why it is happening? I installed and enabled the extension ssh2 in PHP.
I used the following Code:-
$ssh2 = ssh2_connect('myhost');
if (false === $ssh2) {
die('connection failed');
}
$auth = @ssh2_auth_password($ssh, "hostusername", "hostpassword");
if (false === $auth) {
die('authentication failed');
}
echo ssh2_exec($ssh2,'pwd');
But this will the following error: Warning: ssh2_exec(): Connection not authenticated