Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:21639 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 84962 invoked by uid 1010); 23 Jan 2006 04:48:19 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 84946 invoked from network); 23 Jan 2006 04:48:19 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jan 2006 04:48:19 -0000 X-Host-Fingerprint: 66.249.92.198 uproxy.gmail.com Received: from ([66.249.92.198:36927] helo=uproxy.gmail.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 18/EB-06819-11064D34 for ; Sun, 22 Jan 2006 23:48:18 -0500 Received: by uproxy.gmail.com with SMTP id u2so390559uge for ; Sun, 22 Jan 2006 20:48:12 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:references; b=QWevWRyihYX7Jile6P8c1mMPw3BCQrVmNnqkmrC7sTd3aYFDzAVitE7fsfS14aC7BKD1oorxyqSid4AsKInQlTxAQMXCx9FhS2LYEbpw9/AgVdaWR03YEfIzacnpGkwF7Pyl4qNf9KrXFdxAy3SbfNHRtCFu2uB9RF685viv0jM= Received: by 10.48.225.3 with SMTP id x3mr302246nfg; Sun, 22 Jan 2006 20:48:10 -0800 (PST) Received: by 10.49.60.12 with HTTP; Sun, 22 Jan 2006 20:48:12 -0800 (PST) Message-ID: <30bd80240601222048w586f6c8ay8247050f1c9934e6@mail.gmail.com> Date: Sun, 22 Jan 2006 23:48:12 -0500 To: Mark Krenz Cc: internals@lists.php.net In-Reply-To: <20060123031050.GD23755@arvo.suso.org> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_5271_17278097.1137991692155" References: <20060123031050.GD23755@arvo.suso.org> Subject: Re: [PHP-DEV] Fwd: [PHP] proc_open and buffer limit? From: nicobn@gmail.com (=?ISO-8859-1?Q?Nicolas_B=E9rard_Nault?=) ------=_Part_5271_17278097.1137991692155 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline My guess at first look is that you fill the stdout buffer because you don't read from it untill you stop piping data to stdin. On 1/22/06, Mark Krenz wrote: > > > I asked this last night on the general mailing list and also have > asked around about it. Nobody seems to know. I normally wouldn't ask a > support quesiton on a developers mailing list, but nobody else seems to > know so I thought that perhaps a developer knows. > > Why would I be running into this STDIN data size limit when using > proc_open? > > I've tried setting the limits for apache to unlimited in > /etc/security/limits.conf just to see if its a system limit. > > ----- Forwarded message from Mark Krenz ----- > > Date: Sun, 22 Jan 2006 00:25:33 +0000 > From: Mark Krenz > To: php-general@lists.php.net > Subject: [PHP] proc_open and buffer limit? > > > I'm using PHP 5.1.1 on Apache 2.0.54 on Gentoo Linux. I've been trying > to write a program to pass information to a program using proc_open, > however when I do, it only passes the first 65536 bytes of the stream > and then cuts off the rest. To make sure its not the program I'm trying > to send to, I tries using /bin/cat instead and get the same problem. > > Below, I've included the code that I'm using, which for the most part is > from the proc_open documentation page. For testing, I'm reading from a > word dictionary which is over 2MB in size. Is there something I'm > missing about using proc_open? > > ------------------------------------------------------------------------- > $program =3D "/bin/cat"; > > $descriptorspec =3D array( > 0 =3D> array("pipe", "r"), > 1 =3D> array("pipe", "w"), > 2 =3D> array("file", "/tmp/error-output.txt", "a") > ); > > $cwd =3D '/var/www'; > $env =3D array('HOME' =3D> '/var/www'); > > $process =3D proc_open($program, $descriptorspec, $pipes, $cwd, $env); > > if (is_resource($process)) { > > stream_set_blocking($pipes[0], FALSE); > stream_set_blocking($pipes[1], FALSE); > > $handle =3D fopen("/usr/share/dict/words", "r"); > while (!feof($handle)) { > $input .=3D fread($handle, 8192); > } > > fwrite($pipes[0], $input); > fclose($handle); > fclose($pipes[0]); > > while (!feof($pipes[1])) { > $output .=3D fgets($pipes[1], 8192); > } > fclose($pipes[1]); > > print "
$output


\n"; > > $return_value =3D proc_close($process); > > echo "command returned $return_value\n"; > } > ------------------------------------------------------------------------- > > > > -- > Mark S. Krenz > IT Director > Suso Technology Services, Inc. > http://suso.org/ > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > ----- End forwarded message ----- > > > -- > Mark S. Krenz > IT Director > Suso Technology Services, Inc. > http://suso.org/ > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > -- Nicolas B=E9rard Nault (nicobn@gmail.com) =C9tudiant D.E.C. Sciences, Lettres & Arts C=E9gep de Sherbrooke Site web: http://www.lapsus-engineer.org "La libert=E9 est un bagne aussi longtemps qu'un seul homme est asservi sur= la terre." - Albert Camus, Les Justes. ------=_Part_5271_17278097.1137991692155--