proc_open, write error to var instead file??

This is a discussion on proc_open, write error to var instead file?? within the PHP Language forums, part of the PHP Programming Forums category; Howdy, For a script I need the exact output of the apache htdbm.exe to a var so I can ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 01-05-2005
Muffinman
 
Posts: n/a
Default proc_open, write error to var instead file??

Howdy,

For a script I need the exact output of the apache htdbm.exe to a var so
I can extract all users from a database. Now I found out that this can
be done with Proc_open. I got this script from the php website which
looks something like copied below...

Since I can not find very good documentation on this function my
question is: I suppose that the problem is with this
2 => array("file", "error-output.txt", "w") // stderr is a file to

How do I need to edit this to make the 'error' be written in a var
instead of a file..? I tried a few thing but did not succeed.

Thanks in advance, Maarten


$descriptorspec = array(
0 => array("pipe", "r"), // stdin is a pipe that the child will read
from
1 => array("pipe", "w"), // stdout is a pipe that the child will
write to
2 => array("file", "error-output.txt", "w") // stderr is a file to
write to
);
$process = proc_open("E:\\passwords\\htdbm.exe -l
$password_dir\\.htpasswd", $descriptorspec, $pipes);
if (is_resource($process)) {
// $pipes now looks like this:
// 0 => writeable handle connected to child stdin
// 1 => readable handle connected to child stdout
// Any error output will be appended to /tmp/error-output.txt

fwrite($pipes[0], "");
fclose($pipes[0]);

while(!feof($pipes[1])) {
echo fgets($pipes[1], 1024);
}
fclose($pipes[1]);
// It is important that you close any pipes before calling
// proc_close in order to avoid a deadlock
$return_value = proc_close($process);
Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 10:09 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0