Redirect Standard Output Efficiently in .NET

前端 未结 3 1269
旧时难觅i
旧时难觅i 2020-12-03 12:09

I am trying to call php-cgi.exe from a .NET program. I use RedirectStandardOutput to get the output back as a stream but the whole thing is very slow.

Do you have an

3条回答
  •  -上瘾入骨i
    2020-12-03 12:43

    The problem is due a bad php.ini config. I had the same problem and i downloaded the Windows installer from: http://windows.php.net/download/.

    After that and commenting out not needed extensions, the conversion process is alà Speedy Gonzales, converting 20 php per second.

    You can safely use "oProcess.StandardOutput.ReadToEnd()". It's more readable and alomost as fast as using the thread solution. To use the thread solution in conjunction with a string you need to introduce an event or something.

    Cheers

提交回复
热议问题