[SOLVED][Drupal Errors] Warning: "Headers already sent"

| | 2 min read

Many Drupal programmers, Drupal site admins and Drupal site users have encountered errors similar to "Warning: "Headers already sent" in their Drupal site. If you are facing the same situation in your Drupal site then read on to find out the solution.

Here is the solution for the error message.

  • If you are getting a "Headers already sent error" there are 3 likely causes.
  • If it is not the first error message then it is likely to be the after effect of the messages in front of it and you should focus on fixing them
  • Fixing them will likely solve the issue automatically
  • Some text editors will place a UTF-8 byte order mark at the top of a text file. If that is the case the error message will display that "output started at line 1 of some file". Configure the text editor to save the file without the mark.
  • If you receive it as the first error message then it means that the error has occurred at the end of a file. Check out the error message (output started at) to see which file caused this. The error is usually related to extra spaces after a closing tag
  • Drupal files should not have PHP closing tags and deleting them will solve the error.
  • The error could also be caused by blank spaces with extra spaces .inc files
  • Check all .inc and .php files to make sure that there are no closing tags
  • If the message shows that the problem lies with a module try disabling that module to see if it goes away.
  • Enable the output_buffering variable in php.ini file and see if it fixes the issue.

Hope that helps.

The easiest way to solve a Drupal issue is to hand it to the Drupal experts. We can provide a wide range of Drupal services to help you maintain and manage your Drupal websites. Get in touch with us to know more.