Re: Echo from stream_select as output is generated by child process?
| From: | Mike Kilmer | Date: | Thu, 05 Jun 2014 23:25:50 +0000 |
| Subject: | Re: Echo from stream_select as output is generated by child process? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323396@lists.php.net to get a copy of this message | ||
Great feedback from all of you so far!
In the meantime, here is the SO link: http://stackoverflow.com/questions/23945328/multiple-stream-select-with-proc-open-receive-responses-from-slow-process
On Jun 5, 2014, at 6:13 PM, Christoph Becker wrote:
> Mike Kilmer wrote:
>
>> I'm using proc_open to call a python script.
>>
>> The (python) child process takes about a minute to run, and when run
>> from the command line it prints results as they are completed.
>>
>> With the php script, it just prints them all when it's complete.
>>
>> Is there a way to return the python output to the browser in real
>> time?
>
> Have you tried running the PHP script from the command line? It might
> be possible that the PHP script echoes the output of the Python script
> "immediately", but that PHP's output is buffered by the webserver or
> somehow "delayed" by the browser.
>
>> The full script is posted on StackOverflow, and what I think are the
>> relevant segments are below:
>
> It might be useful to post a link to the StackOverflow topic.
>
> --
> Christoph M. Becker