<?php

# http://www.pgregg.com/test/keepgoing.phps

$output "0123456789\n";

ignore_user_abort(true);
header('Content-Length: '.strlen($output));
header('Connection: close');

echo 
$output;
ob_end_flush(); flush();

// browser will drop the connection at this point

sleep(10);
$fp fopen('/tmp/keepgoing.txt''a+');
fwrite($fp"Still going...\n");
fclose($fp);

exit;