开发者

Execute multiple shell_exec at once?

How do I execute multiple shell_exec at once?

Also how do I switch each process to view output from test.php file? I need to know what each process (php file) is doing.

Take a look, example:

index.php

<?php
shell_exec("php test.php");
shell_exec("php test.php");
shell_exec("php test.php");
?>

That does not work how I wanted to be, first shell_exec (test.php) has to be completed first and then it will go to next shell_exec.

test.php

<?php
$section = rand(123,123);
$x = 1;
while($x <= 50) {
 print $section . ": " . $x . "\n";
 $x+开发者_开发问答+;
 sleep(1);
}
?>

It does not output when shell_exec is executed but when I type php test.php manually in shell, it does output.

Or is there a way to open multiple shells?

This is a quick example, however I will be executing multiple PHP file to run CURL


shell_exec("php test.php& php test.php");

Your best bet is to have those scripts log output to a file and actively parse it after running shell_exec().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜