I have a web page ost.php that uses exec (".../ost.exp", $results);
ost.exp was using
send "telnet box23"
expect ...
that changed, now it says:
send "ssh plat@box23"
expect ...
and both methods work just fine.
However, from the command line ost.exp takes 1.2 seconds, from the web page it takes 21 seconds. If I change back to telnet the web page takes about 2 seconds. If from the command line I say >php ost.php it takes 1.5 seconds. Why? And is there anything I can do to fix the extra 19 second delay when going thru the web page?
Tks
Slow SSH via Expect called from webpage.php
Moderator: General Moderators
calling external programs is a performance issue... (thats why there is mod_perl and mod_php instead of the CGI version)
if you only want to telnet, just use fsockopen en write into that socket.. goes much faster
if you only want to telnet, just use fsockopen en write into that socket.. goes much faster
Code: Select all
$fp = fsockopen('box23', 23, ....);
fwrite($fp, 'Hello\r\n';
$in = fread($fp, 1024);
echo $in;
fsockclose($fp);