[support] What is this error mean?

Peter Horn peter.horn at bigpond.com
Tue Sep 15 12:54:06 UTC 2009


A-NO-NE Music wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">Drupal 6.13
>
> I am doing a baby step to module world in order to hack into og 
> detailed block.  So far is does work but comes with an error message:
>
> "warning: Cannot modify header information - headers already sent by 
> (output started at 
> http://mysite.com/sites/all/modules/mymodule/mymodule.module:1) in 
> http://mysite.com/includes/common.inc on line 141."
>
> What does this mean and how do I remedy this?
>
> Here is the code I have (which is pretty much copy/paste from what I 
> found at the Drupal site except the first 2 lines).
>
> <?php
> // $Id$
>
> /**
> * Implementation of hook_og_links_alter().
> */
> function mymodule_og_links_alter(&$links, $group_node) {
> // drupal_set_message(''. var_export($links,TRUE) .'');
> // Remove .. members link and change Invite link to Blablabla in group 
> details block.
> $links['invite'] = 'Blablabla';
> unset ($links['subscribers']);
> }
>
>
> -- 
> - Hiro
>
> Hiroaki Honshuku, A-NO-NE Music, Greater Boston
> http://a-no-ne.com   http://anonemusic.com
>
>
> </div>
>
This error occurs when you have leading white space in your php file - 
Apache (or whatever) parses the php file as 'content' until it sees the 
opening <?php tag, when it switches into interpreting it as php code. 
Once it has started outputting "body", it can't go back and generate 
headers. The fix is to delete everything in your file before the <?php.
I got bitten by this very early in my php life.

Regards,
Peter



More information about the support mailing list