You are here: lib ssh2 functions « PHP « IT news, forums, messages
lib ssh2 functions

Posted by Oscar Gosdinski on 05/14/05 02:16

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

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация