running SSH through a PHP script
| From: | James_Martin at ao dot uscourts dot gov | Date: | Fri, 18 Jul 2003 15:29:50 +0000 |
| Subject: | running SSH through a PHP script | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155784@lists.php.net to get a copy of this message | ||
I am using SSH inside one of my PHP pages to run some commands on a remote
server and return the output web page. In detail, I'm using SSHing 3
different times and it is taking a long time for the resulting page to
load with the output from the remote command. When running top on my
webserver, I see the ssh process come up, do its thing, and quit. The
weird thing is that there is a 15-20 second wait in between the SSH
sessions. My code is not doing anything that should cause it to take this
long--it's just running these SSH commands back to back. I've tried using
system(), passthru(), and backticks, and all yield the same result. If I
try to run something other than SSH, there is no delay. I don't know why
PHP is taking so long between the processes if clearly the process has
finished. I'm running Red Hat Advanced Server 2.1, php-4.1.2, and Apache
1.3.27. There is no delay in the SSH commands when run from a shell, only
through the web page. Any ideas?
Thanks,
James
James S. Martin, RHCE
Contractor
Administrative Office of the United States Courts
Washington, DC
(202) 502-2394