i’m getting a timeout error in a php script that saves a .csv file to the server and then loops through it to populate a database table:
PHP Warning: file(http://www.mydomain.com/myfile.csv): failed to open stream: Connection timed out in myphpfile.php on line 10
line 10 looks like this:
$lines = file($url_path.'/admin/lists/'.$new_file_name);
the following line (11) throws an error as well (because of the timeout) and this code is unable to execute:
foreach($lines as $key=>$val) {
//echo "$key -> $val ++<BR><BR>";
$accountArray = explode(",", $val);
$arraySize = sizeof($accountArray);
//echo "$key -> $val -> $arraySize +++<BR>";
$accountNumber = $accountArray[0];
if ($arraySize == 2) $accountName = $accountArray[1];
else {
array_shift($accountArray);
$accountName = join(",", $accountArray);
}
$accountInsert = "INSERT INTO accounts SET accountNumber = '$accountNumber', accountCompany = '".addslashes($accountName)."'";
//echo "$accountInsert ++<BR><BR>";
$accountResult = mysql_query($accountInsert);
}
If i check the server the file is being uploaded correctly and has permissions set to 777. what could be causing the timeout? what should i check next?
thanks for any help!