Ok before the flaming starts I did some research here and at some other links: Run process with realtime output in PHP
This is what I am currently using:
<?php
$descriptorspec = array(
0 => array("pipe", "r"), // stdin
1 => array("pipe", "w"), // stdout
2 => array("pipe", "w"), // stderr
);
flush(); ?>
<?php $process = proc_open($_POST['field1'], $descriptorspec, $pipes, dirname(__FILE__), null);?>
<?php $stdout = stream_get_contents($pipes[1]); fclose($pipes[1]); $stderr = stream_get_contents($pipes[2]); fclose($pipes[2]); ?>
This works fantastic for outputting any stdout and stderr from a console application to my webpage, however, due to what I am assuming is buffering it does not update in realtime. I have tried the methods in the link I posted and a similar method in Ajax but neither would update in realtime, just wait for all of the input to finish then display on the page.
All I can come up with is that php is waiting for the proc_open() command to finish executing before it tries to do anything with the output.
Any insight would be much appreciated.
Thanks!