note 106349 added to function.readfile
| From: | ben at indietorrent dot org | Date: | Sat, 29 Oct 2011 20:54:16 +0000 |
| Subject: | note 106349 added to function.readfile | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-184223@lists.php.net to get a copy of this message | ||
It should be noted that using Apache's "mod_xsendfile" module as an alternative to
PHP's native readfile() function does have its drawbacks.
With mod_xsendfile, script execution continues immediately after
<?php
header('X-Sendfile: ' . $file);
?>
As such, there is no means by which to delete the file when downloading is complete, determine how
much time the download required (or whether or not the download succeeded), track memory usage
related to the download, etc. When the aforementioned functionality is required, it seems that
readfile() is the only option.
Further, and more importantly, failing to terminate script execution immediately after sending the
headers (e.g., by returning TRUE within a function) seems to cause mod_xsendfile to fail silently
and yield a 404 error.
----
Server IP: 69.147.83.197
Probable Submitter: 76.179.0.31
----
Manual Page -- http://www.php.net/manual/en/function.readfile.php
Edit -- https://master.php.net/note/edit/106349
Del: integrated -- https://master.php.net/note/delete/106349/integrated
Del: useless -- https://master.php.net/note/delete/106349/useless
Del: bad code -- https://master.php.net/note/delete/106349/bad+code
Del: spam -- https://master.php.net/note/delete/106349/spam
Del: non-english -- https://master.php.net/note/delete/106349/non-english
Del: in docs -- https://master.php.net/note/delete/106349/in+docs
Del: other reasons-- https://master.php.net/note/delete/106349
Reject -- https://master.php.net/note/reject/106349
Search -- https://master.php.net/manage/user-notes.php