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?


In reply to CGI, fork, long processes on Apache 2 by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.