I cannot find a good answer to this anywhere. If I start output buffering and die() starts, does it start ob_end_flush() ?
die()
ob_end_flush()
Yes Yes. Each time the script finishes gracefully, the buffers will be empty. The only non-elegant endings are: if he segments errors or if he was killed (signal 9 SIG_KILL). The only place where die() performs a hard kill on a process is to call it inside register_shutdown_function (But the buffers are cleared before the shutdown function is turned off, so there is no problem). See "Handling Connections" for more information ...
register_shutdown_function