On Fri, Jan 14, 2011 at 11:56, Kai Renz <[email protected]> wrote:
>
> 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.
Have you looked into pcntl_fork() or running it in the background
via something as simple as backticks? The latter of which,
exemplified:
<?php
`/bin/env php /path/to/socket2.php --port 1234 >> /path/to/log.txt 2>&1 &`;
?>
Expanding on that, you could do something like this:
<?php
exec('/bin/env php /path/to/socket2.php --port 1234 >>
/path/to/log.txt 2>&1 &',$ret,$err);
if ($err === 0) {
exec('echo $$',$ret);
$pid = $response[0];
echo $pid.PHP_EOL;
} else {
echo 'There was an error while forking the process. Please
view the log.'.PHP_EOL;
}
?>
--
</Daniel P. Brown>
Network Infrastructure Manager
Documentation, Webmaster Teams
http://www.php.net/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php