Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
http://www.stonehenge.com/merlyn/LinuxMag/col39.html
I've written a perl script to tabulate the results of very large research surveys. Sometimes the requested calculation takes a few minutes, so I use a neat trick I picked up from one of Merlyn's columns where I fork the process to perform the calculations, while redirecting the browser to a URL that meta-refreshes on an update page (e.g. "Calculating respondent 29,400 (24%) Estimated time left 4 Minutes 26 seconds".) It works fantastically.
In Apache 1.3.
In Apache 2.0 however the fork/redirect voodoo doesn't work.
At least, I've tried my script on three systems and that seems to be the common thread:
Redhat Linux 7.3 -- Apache 1.3 -- Redirect ok!
Redhat Linux 9.0 -- Apache 2.0 -- Redirect fails in IE, ok in Mozilla Firefox
Redhat Linux Enterprise 3 -- Apache 2.0 -- Redirect fails in IE, ok in Mozilla Firefox
Boo! Evil bastard.
Here's the code in question because everybody likes code:
my $pid; if (! defined ( $pid = fork ) ) { DieNice("Unable to fork: $!\n"); } if ( !$pid ) { close(STDIN); close(STDOUT); } else { print $query->redirect( "$Config::Setting{ScriptsDirectoryURL}/$Config::Setting{Sc +riptFilename}?Command=Update&Update=$Instance{ReportNumber}&Bottom"); exit; }
Merlyn's example of this CGI trick in the article I linked to above also fails to work. It stalls until the script finishes too.
How can I possibly make this work?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CGI, fork, long processes on Apache 2
by Vautrin (Hermit) on Apr 03, 2004 at 18:06 UTC | |
by Anonymous Monk on Apr 03, 2004 at 20:12 UTC | |
by Anonymous Monk on Apr 03, 2004 at 23:36 UTC | |
by Vautrin (Hermit) on Apr 04, 2004 at 20:20 UTC |