Hello Try this , it will work , but I am thinking give u another solution , mean while use this :
<?
$filename = "./something.txt";
$fd = fopen ($filename, "r");
$contents = fread ($fd, filesize ($filename));
fclose ($fd);
print "old file contents : <pre>".$contents."</pre>";
$new_line = "New line : ".date("Y-m-d H:i:s");
$fd = fopen ($filename, "w+");
$string = $new_line."\n".$contents;
fwrite($fd,$string);
fclose ($fd);
$fd = fopen ($filename, "r");
$contents = fread ($fd,(filesize ($filename)*8));
print "New file contents : <pre>".$contents."</pre>";
?>