What does this say?:
- Code: Select all
<?php
include('Net/SSH2.php');
define('NET_SSH2_LOGGING', NET_SSH2_LOG_COMPLEX);
$start = microtime(true);
$ssh = new Net_SSH2('www.domain.tld');
if (!$ssh->login('username', 'password')) {
exit('Login Failed');
}
echo $ssh->exec('pwd');
echo $ssh->exec('ls -la');
//echo $ssh->getLog();
$elapsed = microtime(true) - $start;
echo "<hr>took $elapsed seconds<br>";
?>
Basically, I'm just trying to figure out where the bottleneck is. Is there a specific line that's taking a long time or are all of them taking a long time?
Based on what you've posted thus far it doesn't seem that the first two lines take that much time at all. The constructor took half a second in one instance and in your latest attempt took about a quarter of a second. That's not quite instant, I suppose, but it's better than four seconds.
Also, given that your MATH_BIGINTEGER_MODE isn't MATH_BIGINTEGER_MODE_GMP it's not gonna be as fast as PuTTY no matter what. MATH_BIGINTEGER_MODE_INTERNAL is pure-PHP so it'll never be as fast as pre-compiled assembly and MATH_BIGINTEGER_MODE_BCMATH... well it's done in C and is compiled when it's being used but it's coded pretty badly. It wouldn't take much for any C / C++ implementation to outpace that one.