Welcome to Geeklog, Anonymous Wednesday, October 09 2024 @ 11:29 am EDT

Question: Cannot modify header information - headers already sent by ...

Answer: This problem is actually listed in the "common problems" section of the installation instructions, but many users only seem to run into it when they start configuring their site after the initial setup. So here we go again:

This is commonly known as the "whitespace problem".

The error message typically looks something like

Warning: Cannot modify header information - headers already sent by (output started at /path/to/geeklog/public_html/config.php:581) in /path/to/geeklog/public_html/system/lib-sessions.php on line 180

(line numbers and file names may vary). The problem is that many editors seem to add additional blanks (spaces) and/or empty lines at the end of a file when you edit it. This so-called whitespace is then sent to the browser when the file is loaded and interferes with the header of a page that Geeklog tries to send to the browser, often causing problems such as login problems.

The fix is, obviously, to remove that whitespace from the file. Read the error message carefully. It says "output started at ..." followed by a file name and a line number. That is the file (and line) that you need to edit. Ignore the second file name - that is only a file that included the file that has the whitespace. The first file is the one you have to edit, not the second one.

Since the editor you've been using caused this problem in the first place, you should use another editor to fix the problem and remove the whitespace. See this and this forum thread for some recommendations for editors to use on Windows. Unix/Linux users can't go wrong with vi.

Hits: 2299

FAQ » Common problems » Cannot modify header information - headers already sent by ...