Prev: solution
Next: Mail Function Using PEAR Issues
From: Richard Quadling on 19 Apr 2010 06:53 On 18 April 2010 14:17, ttplayer <fikm(a)qq.com> wrote: > Hello, everyone, please answer me. Thank you. > Â Does PHP support multi-thread ? As you've been informed, PHP doesn't natively support threading. But, the issue of forking was mentioned. I'm on Windows, and by using a combination of MS's WinCache (I'm using V1.1.0412.0), with an environment variable APP_POOL_ID set to something nice and unique (i.e. not set to one used in IIS), and ... $WshShell = new COM("WScript.Shell"); $oExec = $WshShell->Run($script . $params, 0, false); you can successfully run a child script (or __FILE__ . ' /child:$Child ' . $params sort of thing) and use wincache to pass data between the parent and the children scripts. This is working really well for me with the minor exception of having to create the env var up front. Ideally, I'd like to use the fallback logic of having the child script use the parent process id as the identifier, but here the issue is is that the parent script will also use the parent process, so no parent child comms.... http://pecl.php.net/bugs/bug.php?id=17214 But, if you use APP_POOL_ID, then you'll be just fine. Of course, if you are not on windows, then other techniques can be used to simulate this (pcntl, proc_open() - maybe), but I don't know enough to recommend one over the other. -- ----- Richard Quadling "Standing on the shoulders of some very clever giants!" EE : http://www.experts-exchange.com/M_248814.html EE4Free : http://www.experts-exchange.com/becomeAnExpert.jsp Zend Certified Engineer : http://zend.com/zce.php?c=ZEND002498&r=213474731 ZOPA : http://uk.zopa.com/member/RQuadling |