lib ssh2 functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everybody:

I need my PHP application connects through SSH to other server for
getting some info to display and i tried the following code to test
lib ssh2:

$server = ...;
$user = ...;
$passwd = ...;

$con = ssh2_connect($server, 22);
if (ssh2_auth_password($con, $user, $passwd)) {
       $s = ssh2_exec($con, 'ls -l');
       $file = fopen("/tmp/test", "w");
       while ($line = stream_get_line($s, 1024)) {
               fwrite($file, $line);
               fflush($file);
       }
       fclose($file);
} else {
       echo "Authentication Error";
}

The file /tmp/test was created but it does not have any data. I can
connect to the server using a normal ssh session in my laptop and the
'ls -l' command returns me information.
I think that i installed correctly the ssh2 functions because if a put
an incorrect password i get the "Authentication Error" message.

I searched the web for info about similar problems and no results.
Please, anyone can help me with this problem because i have been
spending three days with this.

Thanks in advance for your answers.

-- 
Saludos / Regards
Oscar

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux