I was using a function that made use of proc_open()
to invoke shell commands. It seems the way I was doing STDIO was wrong and sometimes cause
Well, seems a year passed and forgot this thing is still pending!
However, I wrapped up this mess in a nice PHP class which you can find on Github.
The main remaining problem is that reading STDERR causes the PHP script to block, so it has been disabled.
On the bright side, thanks to events and some nice coding (I hope!), one can actually interact with the process being executed (hence the class name, InterExec
). So you can have bot-style behavior in PHP.