proc_open, write error to var instead file??

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


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
   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], "");

    while(!feof($pipes[1])) {
        echo fgets($pipes[1], 1024);
    // It is important that you close any pipes before calling
    // proc_close in order to avoid a deadlock
    $return_value = proc_close($process);

Site Timeline