pib
pib copied to clipboard
Long-living PHP process and comunication with it
I built a wasm with option allowing run it in web worker and it works fine. But when i run script like this:
echo 1; sleep(5); echo 2;
i getting "12" output only after 5 seconds. I considering is there any way (any possibly build config) to make php interactive? I've tried to build it with CLI enabled (https://github.com/oraoto/pib/issues/8#issuecomment-411619996), but i don't know how to use it properly in browser.
I think the UI is locking while PHP executes. If I can get this into a web worker I think we should be able to get it running async.
@szado I've got something in VERY EARLY ALPHA
https://seanmorris.github.io/php-wasm/?code=%253C%253Fphp%250A%250Avrzno_timeout%281000%252C%2520function%28%29%257B%250A%2520%2520%2520%2520%250A%2520%2520%2520%2520print%2520%2522Second%21%255Cn%2522%253B%250A%2520%2520%2520%2520%250A%257D%29%253B%250A%250Aprint%2520%2522First%21%2522%253B%250A&persist=0&single-expression=0
@szado Did you try with a PHP_EOL after each echo
There is this comment // Output is line-buffered, so EOL is needed
So maybe it's the same in a web worker