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";
}
I had the same issue and I solved it with following steps.
1) First I noticed that there is slowliness on server to which we are trying to make sftp connection.
2) There is a script in our side which try to connect and get files from server so because of slowliness issue our scripts can't complete their job and wait for connection because it was very slow. I checked how many processes created for sftp connection with following command
3) Then I killed all these processes with following command
4) After I kill that processes error was gone.
Summary
Main reason of this issue was that. There was slowliness issue in ftp server and we created too many connection. I think there is some limit on server side for max connections.