passthru is generally used for outputting binary data straight to the browser (like loading an image). In this case it sounds like what you want is to update the page with the output of a command in real time. I think rather than trying to refresh or auto-scroll you wold be better off using js (ajax more specifically) to poll another script and edit the DOM in real time. Do some googling for 'xmlhttprequest' and 'ajax' and you can probably find some examples of this.
Paul Mooring
Operations Engineer
www.opscode.com
________________________________
From:
plug-discuss-bounces@lists.phxlinux.org on behalf of Nathan England
Sent: Friday, May 31, 2013 1:58 PM
To: Main PLUG discussion list
Subject: Shell output problem
I have a php script which runs a command that takes a good while to finish, so I have the command running via passthru($cmd); so I can see the output. This works great, with one problem...
The output comes pretty quickly and I have to keep scrolling down the page to see the output.
I want some way to either make the page automatically scroll or refresh the page constantly while the command runs in the background and only shows the latest line of output.
As the bottom of the page has not been reached yet, it seems javascript will not work for me, because I cannot put an id tag of the bottom of the page which has not loaded yet, so javascript doesn't know where to scroll to, unless I'm doing it wrong.
Any advice or help would be great!
--
Regards,
Nathan England
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NME Computer Services
http://www.nmecs.com
Nathan England (
nathan@nmecs.com)
Systems Administration / Web Application Development
Information Security Consulting
(480) 559.9681
---------------------------------------------------
PLUG-discuss mailing list -
PLUG-discuss@lists.phxlinux.org
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss