Reply to Re: proc_open hang (data > 64k)

Your name:

Reply:


Posted by Gordon Burditt on 10/26/05 08:26

>I've written something that takes text and passes it to gpg to encrypt.
>It works great except when the text size is greater than 64k at which
>point PHP/Apache hangs. Is there any way around this? Below is a code
>snippet (which may or may not help).

If you try to set up a two-way set of pipes between a parent and a
child (in any language, on a POSIX-like OS), you're just begging
for deadlock. Especially if you can't modify the source code of
the child and it just expects to act like a filter. Stdio buffering
may create deadlock where you wouldn't otherwise expect it. There
are a couple of possible solutions:

(1) Put either the input or the output in a temporary file rather
than a pipe. You can do both, but that's overkill.
(2) Use non-blocking reads/writes and poll or select.
(I haven't looked at whether this is possible with PHP).
(3) Some types of filters avoid deadlock, for example, sorting
produces no output until all the input has been read.

Gordon L. Burditt

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация