Force a file download with the right headers in PHP

$path = '/var/www/private/invoices/2011-0417.pdf';

header('Content-Type: application/pdf');
header('Content-Disposition: attachment; filename="invoice-2011-0417.pdf"');
header('Content-Length: ' . filesize($path));
header('X-Content-Type-Options: nosniff');

readfile($path);
exit;