Hi,
When I load up my php page I get the following error: -
[Wed Mar 11 17:51:59 2009] [error] [client 91.107.91.93] FastCGI: comm with (dynamic) server "/var/www/fcgi/php-cgi" aborted: (first read) idle timeout (30 sec)
[Wed Mar 11 17:51:59 2009] [error] [client 91.107.91.93] FastCGI: incomplete headers (0 bytes) received from server "/var/www/fcgi/php-cgi"
I get this when I run the following code, when about 5 or more variables of loco are put into the loco array (see / FLEET TO BE LOOKED UP/):-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr" />
<title>Class 7000</title>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber1">
<tr>
<td width="10%" align="center" bgcolor="#000000"><b>
<font face="Arial" color="#FFFFFF">Locomotive</font></b></td>
<td width="10%" align="center" bgcolor="#000000"><b>
<font face="Arial" color="#FFFFFF">Date</font></b></td>
<td width="10%" align="center" bgcolor="#000000"><b>
<font face="Arial" color="#FFFFFF">Train ID</font></b></td>
<td width="10%" align="center" bgcolor="#000000"><b>
<font face="Arial" color="#FFFFFF">Depart</font></b></td>
<td width="25%" align="center" bgcolor="#000000"><b>
<font face="Arial" color="#FFFFFF">Origin</font></b></td>
<td width="25%" align="center" bgcolor="#000000"><b>
<font face="Arial" color="#FFFFFF">Destination</font></b></td>
<td width="10%" align="center" bgcolor="#000000"><b>
<font face="Arial" color="#FFFFFF">Arrive</font></b></td>
</tr>
<?php
/*SET-UP VARIABLES*/
$train_len = 5;
$date_len = 10;
$origin_len = 10;
$destination_len = 10;
$train_offset = 755;
$date_offset = 1006;
$origin_offset = 1325;
$destination_offset = 1575;
$pos_top_banner = 69973;
$needle1 = '</table><br>';
$needle2 = 'top_icon317_1.gif';
$base_url = 'http://logis.korail.go.kr/driveinfo/TrainLocSearchp.jsp?carNo=';
/* FLEET TO BE LOOKED UP*/
$loco[] = "7001";
$loco[] = "7002";
//$loco[] = "7003";
//$loco[] = "7004";
//$loco[] = "7005";
//$loco[] = "7006";
//$loco[] = "7007";
//$loco[] = "7008";
//$loco[] = "7009";
//$loco[] = "7010";
//$loco[] = "7011";
//$loco[] = "7012";
//$loco[] = "7013";
//$loco[] = "7014";
//$loco[] = "7015";
$loco_count = sizeof($loco);
/* LOOP*/
for ($i=0;$i<$loco_count;$i++){
/* GRAB FULL SITE HTML*/
$url=$base_url.$loco[$i];
$contents = file_get_contents($url);
if ( strpos($contents,$needle2) == $pos_top_banner ) {
$train_array[] = "-";
$date_array[] = "-";
$origin_array[] = "-";
$destination_array[] = "-";
} else {
/* ASSIGN TRAIN ID & DATE POSITION*/
$train_position = strpos($contents,$needle1) + $train_offset;
$date_position = strpos($contents,$needle1) + $date_offset;
$origin_position = strpos($contents,$needle1) + $origin_offset;
$destination_position = strpos($contents,$needle1) + $destination_offset;
/* ASSIGN TRAIN ID & DATE VALUES*/
$train = chop(substr($contents,$train_position,$train_len));
$date = substr($contents,$date_position,$date_len);
$origin = substr($contents,$origin_position,$origin_len);
$destination = substr($contents,$destination_position,$destination_len);
$train_array[] = $train;
$date_array[] = $date;
$origin_array[] = $origin;
$destination_array[] = $destination;
}
?>
<tr>
<td width="10%" align="center"><font face="Arial"><?=$loco[$i]?></font></td>
<td width="10%" align="center"><font face="Arial"><?=$date_array[$i]?></font></td>
<td width="10%" align="center"><font face="Arial"><?=$train_array[$i]?></font></td>
<td width="10%" align="center"> </td>
<td width="25%" align="center"><font face="Arial"><?=$origin_array[$i]?></font></td>
<td width="25%" align="center"><font face="Arial"><?=$destination_array[$i]?></font></td>
<td width="10%" align="center"> </td>
</tr>
<?php
} /*END LOOP*/
?>
</table>
</body>
</html>
Does anyone have any suggestions as to how best avoid this error?
Thanks,
JT.