Jump to content

Warning: Cannot modify header information


mentalist

Recommended Posts

I understand the warning, but I don't get the issue on my local server, only on my live server.

From what I can see in the outputted source is a space and also i'm assuming a newline, before the warning...

I've traced every route in my code, no output what-so-ever. I can't believe the hosts would insert such characters.

I've tried separate files within the root directory, an html and a php, neither output these characters.

Eventually I commented out the inclusion of modules one by one and found that the error should be in a specific one of these...

 

Now going through I can't find any 'echo' or 'print' statements.

Everything is within functions, and this error happens before anything is called, just included.

There are no erroneous spaces before or after php code tags.

 

What else would / could produce output? (and why no issue on local server?)

 

 

EDIT:

 

There is no use of 'output buffering' either...

Link to comment
Share on other sites

Cannot directly help you without knowing where the error message states the OUTPUT is occurring AT.

 

You likely have output_buffering turned on in your php.ini, which is hiding the problem on your local development system and the output is probably the BOM (Byte Order Mark) characters that your editor is placing at the start of one or more files.

Link to comment
Share on other sites

hmmm, from the file stated in the 'output' comment, I looked for ref's to 'ob_*' and found a download script. After a bit of trial and error I can pin it down to the 'flush' statement. (? none of this is getting executed though, just included... ?)

 

I remember I found this download script somewhere in the manual (just because my versions failed at some point, so)...

...
header('Content-Description: File Transfer');
header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename='.basename($file));
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: '.filesize($file));
ob_clean();
//flush();
readfile($file);
exit;
...

 

I have now put in 'ob_flush' instead, not that from reading the manual it tells me to do it (it actually states it wasn't being called and is separate to 'flush' entirely). So should I or shouldn't I?

 

Quick tests are indicating that the download script is still working...

 

 

I've not got around to checking the ini references yet, do you still think that is an issue.

I'm using GEdit on Fedora, will that add BOM's to my files, i've never had this issue before...

 

 

Any which way, many many thanks...

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.