$_SERVER[‘DOCUMENT_ROOT’] should get you taken care of. Check this out:
<?php
echo 'Initializing Script...<br>';
$filepath = $_SERVER['DOCUMENT_ROOT']."/data/clients.csv";
echo "the file we seek:".$filepath."<br>";
$handle = fopen($filepath, "r") or die("Error opening file");
$i = 0;
while(($line = fgetcsv($handle)) !== FALSE) {
if($i == 0) {
$c = 0;
foreach($line as $col) {
$cols[$c] = $col;
$c++;
}
} else if($i > 0) {
$c = 0;
foreach($line as $col) {
$client_data[$i][$cols[$c]] = $col;
$c++;
}
}
$i++;
}
fclose($handle);
echo "inital loop good<br>";
echo "<pre>";
foreach ($client_data as $client_row){
$data = $client_row['column_header_label'];
//do whatever
}
?>