sftp - PHP and PHPSec trying to make a connection and getting errors -


i'm trying find easiest way test sftp connection in php. don't intend upload/download files. want open connection, confirm ok, close it.

i came across 'phpsec' seems want, except, can't make work.

my script far is:

<?php require_once '../lib/phpsec/bootstrap.php'; require_once 'splclassloader.php'; $classloader = new splclassloader('phpsec', '../generic/lib'); $classloader->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->login($username, $password))      {         echo 'login failed.';          print "</br>";          $err1 = $sftp->getsftperrors();         print_r($err1);          print "</br>";          $err2 = $sftp->geterrors();         print_r($err2);     } else     {         echo 'connected sftp.';          echo $sftp->pwd();     }  ?> 

the output 'login failed'. output of $sftp->getsftperrors(); blank array. output of $sftp->geterrors(); blank array.

on sftp server can see connection in log files, error:

2014-03-24 11:36:35 [000001ew] {450} ssh_error_code: 11 -> wrong packet size

is there else can change? packet size should use? matter if i'm not transferring fles?

not sure why statements not working, in order see errors of objects method should use try , catch.

try{     $sftp->login($username, $password); } catch(exception $e){     echo $e->getmessage(); } 

hopefully assists in debugging process!


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -