Re: Exec Script in the background, don't wait till it finishes
| From: | Richard Quadling | Date: | Fri, 14 Jan 2011 23:30:50 +0000 |
| Subject: | Re: Exec Script in the background, don't wait till it finishes | ||
| References: | 1 2 3 4 5 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-310773@lists.php.net to get a copy of this message | ||
On 14 January 2011 18:48, Nicholas Kell <nick@monkeyknight.com> wrote:
>
> On Jan 14, 2011, at 12:41 PM, Kai Renz wrote:
>
>> Hi guys and thanks for your answers...
>>
>> @Nicholas:
>> Yes, you are right. The first socket is only used if a new clients
>> connects, thats why the script generates a new port so the client can
>> connect to the new socket. After that socket1 should continue its work
>> and wait for new clients.
>>
>> @Daniel:
>> Yeh i tried sending it to the background, this works but still it does
>> wait for the other script to finish.
>>
>> @Evil Son:
>> Thanks for the tip, i'll try it :)
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>
>
> One more thing to verify: What is the target environment? *nix I hope.
You can launch a non-blocking process in Windows using PHP. I do this a lot.
<?php
$o_Shell = new COM('WScript.Shell');
$o_Shell->Run('C:\\PHP5\\php-win.exe -f script.php --
script_params_would_go_here', 0, False);
// This script can now continue and script.php will be running in parallel.
?>
I use WinCache's Ucache to pass data between the multiple "threads".
Now, use the PECL extension Win32Service, and you can use PHP for
Windows Services, multi-threaded with inter-thread communication.
If you feel mad enough.
Regards,
Richard.
[1] http://msdn.microsoft.com/en-us/library/d5fk67ky(v=vs.85).aspx
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY