Hi Guys,
Hoping somebody out there may have come across this one, possible
functionality request depending on responses.
$descriptor = array(
0 => array("pipe", "r"),
1 => array("pipe", "w"),
2 => array("pipe", "w")
);
$process = proc_open('mysql', $descriptor, $pipes);
fwrite($pipes[0], 'show databases;');
echo stream_get_contents($pipes[1]); //won't work, crash, time out..
nothing returns as we need to..
fwrite($pipes[0], 'show databases;');
fclose($pipes[0]); // note the fclose
echo stream_get_contents($pipes[1]);
I don't want to fclose pipes[0] though, as i want to keep it open and
keep writing to it, alternating with reading from pipes[1] and [2]..
so a replacement for fclose, or an fflush on stdout that works?
The problem appears to be that nothing is returned to php until the
stdin pipe is closed, even if I write hundreds of commands to it.
I'm on php 5.1.6/5.2.4 on various linux installs
recap:
spawn process, keep open for the duration of script execution, read and
write multiple times to same process, then close - even better latch on
to an already running process by id - any ideas methods etc?
Cheers,
Nathan
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php