Starting node from PHP and getting live output
<p>I followed <a href="https://stackoverflow.com/questions/20107147/php-reading-shell-exec-live-output">this guide</a> and tried to call <code>npm start</code> or <code>node somejs.js</code>. The problem is, as soon as the first line from console.log has been printed, the eof is written into the pipe, and so the live output would terminate.</p>

<p>I switched to <code>proc_open()</code> and used <code>proc_get_status()</code> to monitor the running status, and I've got the exact same effect in the end. And the <code>running</code> has turned into <code>false</code> as soon as one line has been printed.</p>

<p>Can anybody suggest to me a better way to achieve what I'd like to achieve? (showing all live outputs from <code>npm start</code> without terminating it, until the command ends naturally).</p>

<p>Thanks in advance!</p>