|
Posted by Georgi Ivanov on 10/14/49 11:25
Hi,
I'm experiencing strange behavior when trying to run background process in
PHP.
Code :
//Run_check.php
foreach ($_POST as $kid){
`php run.php param1 param2 > /dev/null &`;
}
In this case PHP waits all the instances of the process to complete.
I don't understand why.
I have a workaround here, but anyway i don't understand why the above example
doesn't work.
If i don't run the cycle here , but run other file and there run the cycle
that runs the the background processes everything is OK.
------------------------------------
/*This file gets $_POST , implodes it , and passes the string to the other
script */
//Run_check.php
$ids=implode(',',$_POST);
` php run1.php $ids`;
------------------------------------
------------------------------------
/*This script takes the input , explodes it and runs a cycle that runs the
background process*/
//run1.php :
$kwid=explode(',',$argv[1]);
foreach ($kwid as $kid){
`php run.php param1 param 2 > /dev/null &`;
}
------------------------------------
Everything is OK.
Navigation:
[Reply to this message]
|