title: Unable to request pseudo-terminal
body: <p>I am trying to connect to SFTP server. Here is the code : </p>
  
  <pre><code>  set_include_path(get_include_path() . PATH_SEPARATOR . 'phpseclib');
    require_once('Crypt/RSA.php');
    require_once('Net/SSH2.php');
    require_once('Net/SFTP.php');
    $ssh = new Net_SFTP('some.server.com', '22000');
    if (!$ssh-&gt;login('my_login', 'my_password')) {
       $log-&gt;lwrite('SSh Login Failed');
    }
    $dir = "output/";
    $files = glob($dir . "*.*");
  
    foreach($files as $file)
    {
      $fileName = substr($file,strrpos($file,"/")+1);
      if (substr($file,-4) == ".asc"){
          $output = $ssh-&gt;put('dir/'.$fileName,$file,FTP_ASCII); // FTP_BINARY
      }
    }
  </code></pre>
  
  <p>I'm 100 percent sure, that the host, password and login is correct. Because I can access the server with this input through WinSCP. However this is the response I get:   </p>
  
  <blockquote>
    <p>Notice: Unable to request pseudo-terminal in ***/Net/SSH2.php on line 2195</p>
    
    <p>Notice: Connection closed prematurely in ***/Net/SSH2.php on line 2303</p>
  </blockquote>
  
  <p>This is the first time I ever encountered a notice like this. I've already tried to find the answer here, but I found nothing so I had to ask.</p>
  
  <p>Btw every 2-30 seconds sftp server disconnects me when I'm connected through WinSCP with error :   </p>
  
  <blockquote>
    <p>Network error: Software caused connection abort</p>
  </blockquote>
  
  <p>I can say from log, that I get</p>
  
  <pre><code>NET_SSH2_MSG_USERAUTH_SUCCESS
  </code></pre>
  
  <p>also</p>
  
  <pre><code>NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION and NET_SSH2_MSG_CHANNEL_EXTENDED_DATA
  </code></pre>
  
  <p>after which it says Welcome message (local time, experimental ftp server and so on). But after that I get:</p>
  
  <pre><code>NET_SSH2_MSG_DISCONNECT
  </code></pre>
  
  <p>So please, can anybody tell me why does this happen? Thank you in advance :-)</p>
  
  <p>P.S: I have no control of the sftp server that I'm trying to connect to.</p>
  
  <hr>
  
  <h2>EDIT:</h2>
  
  <p>This is the line that is causing the problem :</p>
  
  <pre><code>!$ssh-&gt;login('my_login', 'my_password')
  </code></pre>
  
  <p>And as i said: login, host, port and password are 100% correct.</p>
  
  <h2>EDIT2: extracted log</h2>
  
  <pre><code>00000000  SSH-2.0-mod_sftp
  00000010  /0.9.9..
  
  -&gt;
  00000000  SSH-2.0-phpsecli
  00000010  b_1.0 (openssl, 
  00000020  bcmath)..
  
  &lt;- NET_SSH2_MSG_KEXINIT (since last: 0.1568, network: 0.0003s)
  00000000  p.p ._!...I.$p}.
  00000010  ....ecdh-sha2-ni
  00000020  stp256,ecdh-sha2
  00000030  -nistp384,ecdh-s
  00000040  ha2-nistp521,dif
  00000050  fie-hellman-grou
  00000060  p-exchange-sha25
  00000070  6,diffie-hellman
  00000080  -group-exchange-
  00000090  sha1,diffie-hell
  000000a0  man-group14-sha1
  000000b0  ,diffie-hellman-
  000000c0  group1-sha1,rsa1
  000000d0  024-sha1....ssh-
  000000e0  rsa,ssh-dss....a
  000000f0  es256-ctr,aes192
  00000100  -ctr,aes128-ctr,
  00000110  aes256-cbc,aes19
  00000120  2-cbc,aes128-cbc
  00000130  ,blowfish-ctr,bl
  00000140  owfish-cbc,cast1
  00000150  28-cbc,arcfour25
  00000160  6,arcfour128,3de
  00000170  s-ctr,3des-cbc..
  00000180  ..aes256-ctr,aes
  00000190  192-ctr,aes128-c
  000001a0  tr,aes256-cbc,ae
  000001b0  s192-cbc,aes128-
  000001c0  cbc,blowfish-ctr
  000001d0  ,blowfish-cbc,ca
  000001e0  st128-cbc,arcfou
  000001f0  r256,arcfour128,
  00000200  3des-ctr,3des-cb
  00000210  c...jhmac-sha2-2
  00000220  56,hmac-sha2-512
  00000230  ,hmac-sha1,hmac-
  00000240  sha1-96,hmac-md5
  00000250  ,hmac-md5-96,hma
  00000260  c-ripemd160,umac
  00000270  -64@openssh.com.
  00000280  ..jhmac-sha2-256
  00000290  ,hmac-sha2-512,h
  000002a0  mac-sha1,hmac-sh
  000002b0  a1-96,hmac-md5,h
  000002c0  mac-md5-96,hmac-
  000002d0  ripemd160,umac-6
  000002e0  4@openssh.com...
  000002f0  .none....none...
  00000300  ..........
  
  -&gt; NET_SSH2_MSG_KEXINIT (since last: 0.0148, network: 0s)
  00000000  .......]H.0fFwBZ
  00000010  ...~diffie-hellm
  00000020  an-group1-sha1,d
  00000030  iffie-hellman-gr
  00000040  oup14-sha1,diffi
  00000050  e-hellman-group-
  00000060  exchange-sha1,di
  00000070  ffie-hellman-gro
  00000080  up-exchange-sha2
  00000090  56....ssh-rsa,ss
  000000a0  h-dss....arcfour
  000000b0  256,arcfour128,a
  000000c0  es128-ctr,aes192
  000000d0  -ctr,aes256-ctr,
  000000e0  twofish128-ctr,t
  000000f0  wofish192-ctr,tw
  00000100  ofish256-ctr,aes
  00000110  128-cbc,aes192-c
  00000120  bc,aes256-cbc,tw
  00000130  ofish128-cbc,two
  00000140  fish192-cbc,twof
  00000150  ish256-cbc,twofi
  00000160  sh-cbc,blowfish-
  00000170  ctr,blowfish-cbc
  00000180  ,3des-ctr,3des-c
  00000190  bc....arcfour256
  000001a0  ,arcfour128,aes1
  000001b0  28-ctr,aes192-ct
  000001c0  r,aes256-ctr,two
  000001d0  fish128-ctr,twof
  000001e0  ish192-ctr,twofi
  000001f0  sh256-ctr,aes128
  00000200  -cbc,aes192-cbc,
  00000210  aes256-cbc,twofi
  00000220  sh128-cbc,twofis
  00000230  h192-cbc,twofish
  00000240  256-cbc,twofish-
  00000250  cbc,blowfish-ctr
  00000260  ,blowfish-cbc,3d
  00000270  es-ctr,3des-cbc.
  00000280  ..9hmac-sha2-256
  00000290  ,hmac-sha1-96,hm
  000002a0  ac-sha1,hmac-md5
  000002b0  -96,hmac-md5...9
  000002c0  hmac-sha2-256,hm
  000002d0  ac-sha1-96,hmac-
  000002e0  sha1,hmac-md5-96
  000002f0  ,hmac-md5....non
  00000300  e....none.......
  00000310  ......
  
  -&gt; NET_SSH2_MSG_KEXDH_INIT (since last: 0.0936, network: 0.0001s)
  some data (not sure if safe to share)
  
  &lt;- NET_SSH2_MSG_KEXDH_REPLY (since last: 0.0228, network: 0.0228s)
  some data (not sure if safe to share)
  
  -&gt; NET_SSH2_MSG_NEWKEYS (since last: 0.0169, network: 0.0002s)
  
  
  &lt;- NET_SSH2_MSG_NEWKEYS (since last: 0.0001, network: 0s)
  
  
  -&gt; NET_SSH2_MSG_SERVICE_REQUEST (since last: 0.0332, network: 0s)
  00000000  ....ssh-userauth
  
  &lt;- NET_SSH2_MSG_SERVICE_ACCEPT (since last: 0.026, network: 0.0259s)
  00000000  ....ssh-userauth
  
  -&gt; NET_SSH2_MSG_USERAUTH_REQUEST (since last: 0.0004, network: 0.0002s)
  00000000  ....username....
  00000010  ssh-connection..
  00000020  ..password.....p
  00000030  assword
  
  &lt;- NET_SSH2_MSG_USERAUTH_SUCCESS (since last: 0.1056, network: 0.1052s)
  
  
  -&gt; NET_SSH2_MSG_CHANNEL_OPEN (since last: 0.0003, network: 0.0001s)
  00000000  ....session.....
  00000010  .....@.
  
  &lt;- NET_SSH2_MSG_CHANNEL_OPEN_CONFIRMATION (since last: 0.0114, network: 0.0001s)
  00000000  ................
  
  -&gt; NET_SSH2_MSG_CHANNEL_REQUEST (since last: 0.0003, network: 0.0001s)
  00000000  ........subsyste
  00000010  m.....sftp
  
  &lt;- NET_SSH2_MSG_CHANNEL_EXTENDED_DATA (since last: 0.018, network: 0.0005s)
  00000000  ............Welc
  00000010  ome, archive use
  00000020  r some-server@
  00000030  somevps.nameserve
  00000040  r.sk !....The lo
  00000050  cal time is: Thu
  00000060  Jan 21 09:25:45
  00000070  2016....This is
  00000080  an experimental
  00000090  FTP server.  If
  000000a0  you have any un
  000000b0  usual problems,.
  000000c0  .please report t
  000000d0  hem via e-mail t
  000000e0  o .someemail.sk
  000000f0  &gt;.....
  
  -&gt; NET_SSH2_MSG_DISCONNECT (since last: 0.0006, network: 0.0004s)
  00000000  ............
  </code></pre>