note 15445 added to function.exec

From: Date: Tue, 11 Sep 2001 03:53:36 +0000
Subject: note 15445 added to function.exec
Groups: php.notes 
Request: Send a blank email to php-notes+get-17891@lists.php.net to get a copy of this message
When executing a program in the background AND using sessions, subsequent clicks in the browser won't do anything until after the background process finishes. Even though control is returned to the browser, all clicks will hang. <p> To get around this, here's what I did: <p> <? session_start(); $userid = $HTTP_SESSION_VARS["userid"]; //... assign $command to the command to execute exec("$command >/dev/null &"); session_unregister("userid"); session_destroy(); session_start(); session_register("userid"); // rest of script. ?> <p> It's a hack because you get a new session id, but if you can live with that, it may be of some help. <p> Note: This is 4.06 / apache 1.3.20 / linux http://www.php.net/manual/en/function.exec.php

« previous php.notes (#17891) next »