I am trying to get the output of the command to be displayed on the clients browser as the actual command runs, so far it successfully completes the command and then all the relevant output is displayed. However, as this can take up to 30 seconds i'd like the ongoing output that would appear on the shell screen to be forwarded in real time to the browser. The command should be started by the press of a button.
The Button
<div class="inner"><form action="" method="post">
<button type="submit" name="button5">Update Game Server</button>
</form>
</div>
The code to run the system command
<?php
if (isset($_POST['button5'])) {
chdir('/home/aname/steamcmd/');
echo '<br></br>';
echo '<pre>';
echo shell_exec ('./steamcmd.sh +logon aname apass +app_update validate +quit');
echo '</pre>';} ?>
I have seen similar posts where people have suggested using passthru(), popen(), ob_flush() & flush()
however, if I use these options instead of system_exec()
they don't update the page, they once again only show the completed output in the browser once the entire process has been completed.
I suspect the way I am implementing the button may be more of an issue than the way the command is actually being sent to the system but not sure what to try.
Apache/2.4.29 , CentOS 7, PHP version: 5.6.30