Drupal V5.x warning: Cannot add header information

A very common error while trying to modify the user profile in Drupal 5.x is:

warning: Cannot add header information - headers already sent

This is usually an issue associated with line breaks or text file encoding.

Confirmed Solution for Drupal 5.1

  • Stop using MS Notepad, Download Context ( http://www.context.cx/ )
  • Make sure all your files are in DOS (ANSI) not Unicode. (Context -> Convert Test To -> Dos)
  • Usually the files that are in Unicode are the ones that display in the error message.
  • /includes/theme.inc
  • /includes/common.inc
  • theme-dir/template.php
  • theme-dir/user_profile.tpl.php
  • Eliminate all but 1 line break from the end of all of the php (template and user_profile) and inc (/includes/*) files.

    Please only post specific solutions to your problem as comments.

  •  
     

    Drupal is a registered trademark of Dries Buytaert.