August 3rd, 2000, 04:54 PM
I want to do two things on the same page in PHP. The first is quick and I want to output the result to the client (this works). The second takes a long time and depends on the result of the first. Basically what I would like to do is:
<BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">code:</font><HR><pre><html>
Do fast job, output to client
Do slow job, have already closed connection to client so client doesn't care that it's slow.
However, I don't know how to close the client connection. The client's browser sits there waiting for the script to end.
One other solution I think would be to use "system()" to start a CGI script. Two problems, I don't know how to compile and run PHP as a CGI script, and I don't think I have a PHP binary executable on my host.
Any help appreciated.
August 3rd, 2000, 05:26 PM
Regardless what your logic is, you can try to execute/include a Perl script. for the bottom part.
August 3rd, 2000, 11:07 PM
August 4th, 2000, 12:47 AM
Yup, I've read the section on connection handling. Unfornately it only deals with what happens if the client closes the connection during execution of the script. It doesn't describe how to close the connection and continue script execution (or really anything to do with server side control of the connection).
August 5th, 2000, 11:52 PM
Oh, that... easy; you have a couple of ways:
1. Send a URL header to redirect the browser to another page, such as:
header ("Location: your_logout_page.php?a_variable_if_you_want_one=$foo");
(normally one would call the 'exit;' command afterward to end any further execution of the present script, but in your case, you would just want to call the header, and redirect the browser while the script finishes execution.)
Yes, you have no real server-side control of the client connection, because there is no true 'connection' -- such as a socket -- with HTTP. But one (or both) of the above will be the next best thing.