|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42053 code execution stops after header() - readfile()
Submitted: 2007-07-20 14:56 UTC Modified: 2007-07-20 15:42 UTC
From: gianluca dot sibaldi at 51factory dot com Assigned:
Status: Not a bug Package: HTTP related
PHP Version: 4.4.7 OS: Windows NT WEBS44 5.2 build 3790
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
35 - 24 = ?
Subscribe to this entry?

 [2007-07-20 14:56 UTC] gianluca dot sibaldi at 51factory dot com
After executing a download process built with header() and print()
can't get any further output to browser page.

Reproduce code:
$file = "my_file_to_dowload.txt";

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: no-store");
header("Cache-Control: private",true);
header("Content-Type: application/octet-stream");
header('Content-Disposition: attachment; filename="'.$file.'"' );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($file));

echo("After I successfully downloaded the file, I can't see this line printed in browser window...");

Expected result:
I expect that the code just after
is being executed.
In this case I wish to see in browser window the message sent with echo

Actual result:
Anything in php code which is after the block


is ignored.
Exactly like the code was:



Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-07-20 15:42 UTC]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at and the instructions on how to report
a bug at

HTTP offers only one output stream -> You\'re writing to the file using your echo statement.
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Tue Jun 06 03:03:42 2023 UTC