Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- $cmd = "php /path/to/b.php";
- $descriptorspec = [
- 0 => ["pipe", "r"], // stdin is a pipe that the child will read from
- 1 => ["pipe", "w"], // stdout is a pipe that the child will write to
- 2 => ["pipe", "w"] // stderr is a pipe that the child will write to
- ];
- $process = proc_open($cmd, $descriptorspec, $pipes, realpath('./'), []);
- // your program here
- echo 'this is a.php stuff';
- for($i = 0; $i < 5; $i++) { echo "."; sleep(1); }
- // read the output of b.php at the end
- if (is_resource($process)) {
- while ($s = fgets($pipes[1])) {
- echo $s;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement