# Help with php troubleshooting

**URL:** https://forum.kirupa.com/t/help-with-php-troubleshooting/291443
**Category:** Uncategorized
**Created:** [June 30, 2009, 12:42am UTC](https://forum.kirupa.com/t/help-with-php-troubleshooting/291443 "2009-06-30T00:42:52Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![natronp](https://avatars.discourse-cdn.com/v4/letter/n/87869e/32.png) [@natronp](https://forum.kirupa.com/u/natronp)
#### Post date: [June 30, 2009, 12:42am UTC](https://forum.kirupa.com/t/help-with-php-troubleshooting/291443/1 "2009-06-30T00:42:52Z")

</div>

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](http://www.mydomain.com/myfile.csv)): failed to open stream: Connection timed out in myphpfile.php on line 10

line 10 looks like this:

```auto
$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:

```auto
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!
