[prev in list] [next in list] [prev in thread] [next in thread] 

List:       php-general
Subject:    [PHP] running process in the background
From:       Georgi Ivanov <joro () abacustrade ! com>
Date:       2005-08-31 16:44:09
Message-ID: 200508311944.09974.joro () abacustrade ! com
[Download RAW message or body]

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

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic