running process in the background

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux