-
-
#!/usr/bin/env php
- /**
- * php multi-process
- * by bbs.it-home.org
- */
- $cmds=array(
- array('/app/test.php' ,'charge/pstat.php','mobile',1),
- array('/app/test.php','charge/pstat.php','mobile',2),
- array('/app/ test.php','charge/pstat.php','click',1),
- array('/app/test.php','charge/pstat.php','click',2),
- array( '/app/test.php','charge/pstat.php',1),
- array('/app/test.php','charge/pstat.php',2)
- );
foreach($cmds as $cmd){
- $pid=pcntl_fork();
- if($pid==-1){ //Process creation failed
- die('fork child process failure!');
- }
- else if($pid){ //Parent process processing logic
- pcntl_wait($status,WNOHANG);
- }
- else{ //Child process processing logic
- pcntl_exec('/usr/local/bin/php', $cmd);
- }
- }
- ?>
-
Copy code
|