I am trying to do a ssh connection in php. But I get this error Unable to startup sftp subsystem. I don't understand it. And I could not find much in google. Please let me know how to debug this. I am using wamp.
$resConnection = ssh2_connect($strServer, $strServerPort);
if(ssh2_auth_password($resConnection, $strServerUsername, $strServerPassword)){
//Initialize SFTP subsystem
$resSFTP = ssh2_sftp($resConnection); -->error coming here
}else{
echo "Unable to authenticate on server";
}
It's hard to say without more information. Unfortunately, libssh2 is pretty limited in the amount of info it provides. I'd recommend you use phpseclib, a pure PHP SFTP implementation. eg.
Put
define('NET_SSH2_LOGGING', 3)at the top to get logs if you still encounter the problem, after switching. Then post the logs so that you can get better assistance.Thanks!