The below code works for both way processing ;) Have fun folks
<?php
system("mkfifo pipeout");
$pipe = popen("./nwserver -module Chapter1E > pipeout","w");
$pipeout = fopen("pipeout", "r");
while ($s = fgets($pipeout,1024)) {
echo $s;
}
?>