I've got a command-line app that continuously prints to the screen, and I'd like to be able to either dump that data to a file or (preferable) grab the last n lines with PHP, as it will be started from a PHP script. Is there a way to do either of those?
They mention on the PHP.net exec() function list that if you want to do just that, then you should redirect the output to a file. I tried using > to redirect it, but it hangs there waiting for the app to finish (regardless of whether I call it from PHP or right from a terminal). What other methods are there of redirecting output?