How can PHP scripts be optimized to handle large file downloads efficiently?

Large file downloads in PHP can be optimized by using the `readfile()` function instead of loading the entire file into memory with functions like `file_get_contents()`. This allows the script to efficiently stream the file to the client without consuming excessive memory. Additionally, setting appropriate headers like `Content-Length` and `Content-Disposition` can improve the download experience for users.

$file = '/path/to/large/file.zip';

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="' . basename($file) . '"');
header('Content-Length: ' . filesize($file));

readfile($file);