It is not possible to use the function 'pcntl_fork' when PHP is used as Apache module. You can only use pcntl_fork in CGI mode or from command-line.
Using this function will result in: 'Fatal error: Call to undefined function: pcntl_fork()' 所以只能想其它方法进行处理了。
Using this function will result in: 'Fatal error: Call to undefined function: pcntl_fork()' 所以只能想其它方法进行处理了。
后来查看到可以用popen开进程来处理,然后用feof来确定进程是否结束:
- foreach ($generateFiles as $generateNumber => $generateMsg) {
- $generateNumberArr[$generateNumber] = popen("php /var/www/html/DNSnew/include/generateZonfConf.php " . $generateMsg . " " . $serial . " " . $forderDir, 'r');
- }
- foreach ($generateNumberArr as $generateNumberArr_k =>$generateNumberArr_v) {
- while (! feof($generateNumberArr_v)) {
- $buffer = fgets($generateNumberArr_v, 4096);
- if (strstr($buffer, 'ff0000')) {
- $forderDir = false;
- }
- usleep(100000);
- }
- pclose($generateNumberArr_v);
- }
上述方法很好的解决了我需要处理的问题
备注:对于php的外围参数是不可以传数组的