| Apr 07 |
HTTP sessions and background processes on Apache-PHPOK , so you are all excited about running a 10 minute process and you are happy that
Consider this script [parentProcess.php] $backgroundCall = 'php childProcess.php > /dev/null &'; shell_exec($backgroundCall ); echo "Hello world ! My background job is fired"; // other code , redirects etc When you call a background file with the ‘amersand’ in the end, it sure becomes a background file. Why is that ? [There is bug described here and it is still not solved even in the php 5.0+ versions.] What happens is that the child process which is called by the system() ,exec() or shell_exec() command Solution:There are places on the internet which provide C code and perl code to do that. But PHP has its own $backgroundCall = 'php childProcess.php > /dev/null &'; session_write_close(); shell_exec($backgroundCall ); echo "Hello world ! My background job is fired"; // other code , redirects etc 2 Responses to “HTTP sessions and background processes on Apache-PHP”Leave a Reply |
Hello! I just wanted to say THANKS! This saved me having to re-write my own session handler. I just wanted to add (since it might help others) that it doesn’t necessarily apply only to background threads (I am on Windows / Apache 2.2 / PHP 5.2.9-2 module).
Your browser does not support iframes.
</iframe