Page 1 of 1

PHP Task delegation....as such....

Posted: Mon Jan 20, 2003 1:29 pm
by nonny
Is there a way for a PHP script to activate the processing of another PHP function so that it can return data to the client without having to wait for the activated functions to finish?

For example, I have a PHP script that handles large amounts of form data. Some functions will return an "All Ok" page to the client. But only after all the non-client functions are completed, such as database functions and confirmation emails to the webmaster, thus slowing down the time for the page to be sent back to the client. Is there a way for these functions to be run in their own 'thread' so to speak? So the page will be sent back to the client whilst the server processes the other stuff not required for that page?

Posted: Mon Jan 20, 2003 2:59 pm
by mydimension
since php is not multi-threaded on a script basis, this is rather difficult if not impossible. you might check out the the tick functions: http://www.php.net/declare they provided a psuedo multi-tasking functionallity that might help. ive never used them so i don't know how they perform.