Sorry, not sent to the list.
---------- Forwarded message ---------- From: Evil Son <ewilsonm...@gmail.com> Date: Sat, Jan 15, 2011 at 4:26 AM Subject: Re: [PHP] Exec Script in the background, don't wait till it finishes To: Kai Renz <writeme...@googlemail.com> On Sat, Jan 15, 2011 at 2:56 AM, Kai Renz <writeme...@googlemail.com> wrote: > Hi there, > > i'm currently working on a socket project. It consists of two scripts. > The first script (socket1.php) creates a socket on a specified port > and waits for a client to connect. If a client connects, they exchange > some informations, including a random created port. Next, the first > script calls the second script (socket2.php) with the just created > port number as a parameter. > > Now here is the problem: > it all works fine, but the client can't send a quit message to socket1 > because socket1.php waits until socket2.php is finished. socket2.php > is working properly, and if i connect to the new socket and quit the > connection, socket1 is working again. All i need socket1 to do is to > continue working independant of socket2. > > I tried everything, from shell_exec to pcntl_exec, nothing seems to work. Looking at the manual, shell_exec will wait for the other script to return (just like calling the 2nd script"), pcntl_exec replaces the original server with the new one. pcntl_fork is what you want but it is non-windows. Hopefully you are running on *nix. HTH -- Regards Evil Son -- Regards Evil Son -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php