0

I am writing a php interface in which the input is passed to an ant target which is working fine, however, what I would like is for the output of the ant build process to be displayed in my browser. What I am doing now is the following

<?php
    if (isset($cleaned)){
        echo "<div class='output'>";
        echo "<p>'".$cleaned."'</p>";
        echo "</div>";
        $arg1 = escapeshellarg($cleaned);
        echo exec("sudo scripts/set_vars.sh $arg1");
     }
?>

But it just returns the last line of the process. I want to see the entire process much like the console output in Jenkins.

Help would be appreciated

Ed Dunn
  • 1,152
  • 3
  • 11
  • 27
  • http://php.net/manual/en/function.system.php or http://php.net/manual/en/function.passthru.php On the `exec()` man page there is a _See Also_ section. – AbraCadaver Nov 06 '15 at 16:45
  • Compare [exec](http://php.net/manual/en/function.exec.php) with [shell_exec](http://php.net/manual/en/function.shell-exec.php). One returns just the last line, the other returns all the output. – Barmar Nov 06 '15 at 16:49
  • the problem is it waits until the process if finished before echoing out the output and it does not output it to the same page (shell_exec and passthrough). I would like it to be live line for line – Ed Dunn Nov 06 '15 at 16:52

0 Answers0