Skip to content

Instantly share code, notes, and snippets.

@mageekguy
Created March 12, 2013 11:36
Show Gist options
  • Save mageekguy/5142226 to your computer and use it in GitHub Desktop.
Save mageekguy/5142226 to your computer and use it in GitHub Desktop.
Test of proc_open() with php under windows…
<?php
$php = proc_open('php', array(array('pipe', 'r'), array('pipe', 'w'), array('pipe', 'w')), $pipes);
fwrite($pipes[0], '<?php ');
for ($i = 0; $i <= 9000; $i++)
{
fwrite($pipes[0], '/');
}
fclose($pipes[0]);
echo 'STDOUT: ' . stream_get_contents($pipes[1]) . PHP_EOL;
fclose($pipes[1]);
echo 'ERROR: ' . stream_get_contents($pipes[2]) . PHP_EOL;
fclose($pipes[2]);
proc_close($php);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment