I have a default Apache 2.2 system setup with a Perl CGI script directory configured like so:

ScriptAlias /jarvis/ "/opt/jarvis/cgi-bin/"

Nothing fancy in here except one of my scripts takes over 10 minutes to process, and due to various reasons, prints out nothing during this time.

Apache appears to have a timeframe of 10 minutes (600 seconds) for CGI scripts to run - and if no output appears from the script in this timeframe then the script is killed and a 500 response is sent to the browser/client.

The message:

[Thu Apr 23 13:57:53 2009] [warn] [client] Timeout waiting for output from CGI script /opt/jarvis/cgi-bin/jarvis.pl

appears in the log on one system (Ubuntu, installed via apt-get), but doesn't on another (Windows, installed via package download).

My question is - is there any configuration in Apache 2.2 that would allow me to run a script longer than 10 minutes without it being killed?


Writing log messages out regularly avoids this error - so a log message written every few minutes ensures that long running processes don't get killed. I eventually solved my problem by implementing a progress bar on the client and having my script write a "." every so often to update the bar on the other end.

Thanks, Jamie

3 Answers 3


The TimeOut directive defines the length of time Apache will wait for I/O in various circumstances:

  1. When reading data from the client, the length of time to wait for a TCP packet to arrive if the read buffer is empty.
  2. When writing data to the client, the length of time to wait for an acknowledgement of a packet if the send buffer is full.
  3. In mod_cgi, the length of time to wait for output from a CGI script.
  4. In mod_ext_filter, the length of time to wait for output from a filtering process.
  5. In mod_proxy, the default timeout value if ProxyTimeout is not configured.
  • I'd agree, except I have: Timeout 300 In my apache.conf file, and it doesn't limit to 5 minutes.
    – Jamie Love
    Apr 23, 2009 at 2:51
  • 1
    How does Apache kill the child CGI script? I need to catch that, but can't find any docs on whether it's possible for the child to cleanly shutdown when it's killed by Apache.
    – Alnitak
    Jan 10, 2011 at 12:19
  • @JamieLove: A scant 3+ years later.. I ran into the same thing. The problem was that even though I didn't specify it, apache was using mod_cgid, not mod_cgi.. mod_cgid in 2.2.x doesn't seem to honor the timeout. While I suspect that you've probably resolved your problem by this point.. I leave this feedback for the next guy who has this same issue. :p Feb 23, 2012 at 19:37
  • @synthesizer 3 more years later, I found out that mod_cgid follows the convention since 2013 (2.4.10, 2.2.28). See also CVE-2014-0231.
    – Timothy Gu
    May 2, 2015 at 18:00
  • @Alnitak i know this is old, but for new readers.... I think apache simply closes its read ends of the read and write pipes. Since the kernel knows that these pipes have only one open end, it sends SIGPIPE to the writer, to let it know you should go away - nobody is reading you. If you don't do any special signal handling, SIGPIPE will just terminate the process. If you need to do something special, your CGI should catch SIGPIPE and do a more orderly shutdown Dec 1, 2016 at 15:43

As shown on http://cweiske.de/tagebuch/Running%20Apache%20with%20a%20dozen%20PHP%20versions.htm :

FastCgiServer /var/www/cgi-bin/php-cgi-5.3.1 -idle-timeout 120

The idle timeout sets the time in seconds that apache waits for the cgi to return something


This error is from the database which queries are running behind it, either its indexing is not done properly or that query is slow, please check the error will never come again

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy