Running a MySQL intensive PHP script that is failing. Apache log reports this:
[Wed Jan 13 00:20:10 2010] [error] [client xxx.xx.xxx.xxxx] (70007)
The timeou
Note: This answer is duplicated verbatim from a similar question.
Original Answer
I have Apache 2.4.6, but the patch to fix it is provided in Apache >= 2.4.8. The key here is to start your output immediately so that Apache (mod_proxy_fcgi) thinks the connection is active.
For example, I am using PHP and the DB query for my AJAX call takes > 30 seconds. Because I know that the overall response will be "Content-Type: application/json", I send that header immediately.
#1: Start output immediately
#Note: Sending the header is innocuous
# it can be changed later using the $replace parameter
# (see #3)
header( 'Content-Type: application/json' );
#2: Run slow query
mysql_query( "SELECT * FROM giant_table" );
#3: Change header as needed
header( 'Content-Type: application/csv', true );
#output content