Sheryl wrote:
Greetings, I have a situation in which a PHP script is getting hung on a socket call and never exiting. Also never getting to the point of sending back any output to the client in the form of HTML. Before you tell me to ask the PHP list though, the language of the script is really irrelevant (and I have already posted on a PHP list concerning the call that is hanging). The point is, my reading of the docs on the various timeouts in apache leads me to think that unless there is something on the way to/from the client none of the timeouts apply. I don't see a way to limit the time that something is *preparing* to send back a response.
I have had some locally build PHP scripts that run a very long time (doing database lookups and so forth) before outputting the desired content. These would time out like that.
Of course, a user would sit around waiting for a result and give up as well. So I resolved both of these by putting a progress bar out in the output to start with:
echo "<script language=JavaScript " . " src=/images/ProgressBar.js></script>\n"; echo "<div id=loading_bar></div>\n"; echo "<script language=JavaScript>\n"; echo " progressBar = " . "new ProgressBar('/images/Wrt_progressbar_empty.png'," . " '/images/Wrt_progressbar_full.png', 404, " . " 12);\n"; echo "progressBar.appendTo(document.getElementById('loading_bar'));\n"; echo "</script>\n"; flush();Then I'd put in the database processing loop output that would advance the progress bar:
$pct = (int)( ( ($idx) * 100 ) / $limit); echo "<script language=JavaScript>setPercentage($pct);</script>\n"; echo "<script language=JavaScript> " . " progressBar.setLoadingProgress($pct);</script>\n"; flush(); The PHP flush() function is described here: http://php.net/manual/en/function.flush.phpThe ProgressBar.js script I got someplace, don't recall where, and it only has as its internal documentation as "author pit" which doesn't help much. Bottom line is the resolution to your PROBLEM might be the PHP flush() function, to make your SCRIPT compatible w/ your Apache timeouts, while the way you hide the jumpiness this might push into your users' browsers is to actually USE the delay to tell the user something they might be interested in, like this progress bar or some other one. The JavaScript itself is only 93 lines including commentary, so I'm happy to share that out if anybody wants it.
-- J.Lance Wilkinson ("Lance") InterNet: Lance.Wilkinson@xxxxxxx Systems Design Specialist - Lead Phone: (814) 865-4870 Digital Library Technologies FAX: (814) 863-3560 E3 Paterno Library Penn State University University Park, PA 16802 --------------------------------------------------------------------- The official User-To-User support forum of the Apache HTTP Server Project. See <URL:http://httpd.apache.org/userslist.html> for more info. To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx " from the digest: users-digest-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx