Im trying to save all the output lines from a console to a file the code is not working because what it currently does is
Get the last line from console and write it on the file, and also the file isnt updated until I close the process the console is running-
$start = exec("cd /ot/forgottenserver && ./tfs", $output);
$file = fopen("/var/www/public/stream.html", "a+");
while ($start)
{
fwrite($file, $start."\n");
}
fclose($file);
I need to write everytime I get a new line from the console and also update the file while the process is executing.