php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #9824 lack of bidirectional popen()
Submitted: 2001-03-18 16:47 UTC Modified: 2002-05-22 07:11 UTC
Votes:5
Avg. Score:4.8 ± 0.4
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:3 (60.0%)
From: morten at nilsen dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.4pl1 OS: Linux 2.4.2
Private report: No CVE-ID: None
 [2001-03-18 16:47 UTC] morten at nilsen dot com
I'm using php for shell scripting, and my current project is
an indexer of smb shares.
using shell commands (in this case smbclient) without the
ability to interact, Creates a serious bottleneck, as it
becomes neccessary to execute smbclient once for each folder
on each share on each host on the network.

well that's my two cents.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-17 13:32 UTC] phpbug at mrdrew dot com
I would also like to have a bidirectional popen. Currently, both myself and another poster on the popen page of idocs can only do this by creating two 'named' pipes on the fs.  Then read and write to them.  This is flawed though because of blocking on the named pipes by the readers/writers.  *** oddly, if I popen('openssl', 'w'),write to it, then try to read from it then pclose() it spews the stdout from openssl into the browser.  I was unable to assign this output to a variable either.  Other posters at popen doc page seem to be trying to do this with popen('[some command]', 'r+') or 'w+', so this is definietly needed in PHP as it is in C.  Sorry about the length.
 [2002-03-17 13:35 UTC] derick@php.net
From the popen man page on Linux:

DESCRIPTION
       The  popen() function opens a process by creating a pipe, forking, and invoking the shell.  Since
       a pipe is by definition unidirectional, the type argument may specify only  reading  or  writing,
       not both; the resulting stream is correspondingly read-only or write-only.

Suspending until Linux supports it.

Derick
 [2002-05-22 07:10 UTC] jtoy at mac dot com
please man popen on any BSD system.  Until linux supports it?!?!?!
 [2002-05-22 07:11 UTC] derick@php.net
It's actually implemented now, see www.php.net/proc_open

Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 09:01:29 2024 UTC