You are here: running process in the background « PHP « IT news, forums, messages
running process in the background

Posted by Georgi Ivanov on 10/20/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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация