title: PHP and PHPSec trying to make a connection and getting errors
body: <p>I'm trying to find the easiest way to test a sFTP connection in PHP. I don't intend to upload/download any files. I just want to open a connection, confirm it is OK, then close it.</p>
  
  <p>I came across 'phpSec' which seems to do what I want, except, I can't make it work.</p>
  
  <p>My script so far is:</p>
  
  <pre><code>&lt;?php
  require_once '../lib/phpSec/bootstrap.php';
  require_once 'SplClassLoader.php';
  $classLoader = new SplClassLoader('phpSec', '../Generic/lib');
  $classLoader-&gt;register();
  
  
  $server = "123.456.789.012";
  $port = "22";
  $username = "xxx";
  $password = "xxx"; 
  
  set_include_path(get_include_path() . PATH_SEPARATOR . 'c:\Apache\htdocs\phpseclib');
  define('NET_SSH2_LOGGING', 2);
  
  include 'phpseclib/Net/SFTP.php';
  
  define('NET_SFTP_LOGGING', NET_SFTP_LOG_COMPLEX);
  
  $sftp = new Net_SFTP($server);
  
  // Check SFTP Connection
  if (!$sftp-&gt;login($username, $password)) 
      {
          echo 'Login Failed.';
  
          print "&lt;/br&gt;";
  
          $ERR1 = $sftp-&gt;getSFTPErrors();
          print_r($ERR1);
  
          print "&lt;/br&gt;";
  
          $ERR2 = $sftp-&gt;getErrors();
          print_r($ERR2);
      }
  else
      {
          echo 'Connected to SFTP.';
  
          echo $sftp-&gt;pwd();
      }
  
  ?&gt;
  </code></pre>
  
  <p>The output from this is 'Login Failed'.
  The output of <code>$sftp-&gt;getSFTPErrors();</code> is a blank Array.
  The output of <code>$sftp-&gt;getErrors();</code> is a blank Array.</p>
  
  <p>On the sFTP server I can see the connection in the log files, with the error: </p>
  
  <blockquote>
    <p>2014-03-24 11:36:35 [000001ew] {450} SSH_ERROR_CODE: 11 -> Wrong
    packet size</p>
  </blockquote>
  
  <p>Is there anything else I can change? What packet size should I use? Does it actually matter if I'm not transferring any fles? </p>