I'm looking for a server-wide setting for timeout with mod_perl scripts under Apache 2.2, similar to max_execution_time
in php.
Timeout can be done with $SIG{ALRM}
but it requires modification to every perl script and is incompatible with with sleep()
.
Apache has a TimeOut
configuration directive, however it has no effect on mod_perl. With TimeOut 5
, timeout does not occur for a test script that sleeps for 10 seconds before printing anything.
The Apache2::ServerRec
module has a timeout()
method, but it simply gets/sets the value of Apache's TimeOut
variable, and therefore has no effect on mod_perl as well.
How can it be done? If it cannot be done, what is the best practice for timeout in mod_perl?
mod_perl
does not, unfortunately, have a way of doing this. What does have a way of implementing timeouts itsmod_fcgid
(via the FcgidBusyTimeout directive). This shouldn't require any significant modifications to your script, unless its making use ofmod_perl
specific functionality.A good comparison between
mod_perl
andmod_fcgid
is available on StackOverflow, but if implementing universal timeouts is your requirement,mod_fcgid
sounds like its the only way to go.