Author Topic: Cannot add header information - headers already sent by...  (Read 41362 times)

0 Members and 1 Guest are viewing this topic.

Offline Chris

  • 4images Moderator
  • 4images Guru
  • *****
  • Posts: 4.487
  • Did u ever stop to think and then forget to start?
    • View Profile
Cannot add header information - headers already sent by...
« on: January 03, 2003, 03:22:40 AM »
There are three common reasons you might get an error that looks like the following:
Quote
Warning: Cannot add header information - headers already sent by
(output started at /home/sites/site57/web/membership/gallery/config.php:36)
in /home/sites/site57/web/membership/gallery/admin/admin_functions.php on line 169

1. If you have edited ANY of the 4images php files, including <language>/main.php, open all files you have edited and delete any and all characters before:
<?php
and after:
?>
the very last at the end of the file. This includes trailing spaces, tabs, carriage returns, etc.

2. If you start to get this error after including a non-4images php file in the templates, the most likely cause is that the included file is trying to output a complete page to the browser which naturally includes HTTP headers.  Typical php files that do this are poll and news scripts.

One solution for this senario is to place an inline frame somewhere in your template where you want the output of the included script to appear.  The HTML code for this would look something like:
Code: [Select]
<iframe src="/polls/latest.php" width="150" height="450" scrolling="no" frameborder="0"></iframe>
3.  If you are trying to include php files in the 4images templates, sometimes it helps to break up the include into three lines like the following example:<?php
include($_SERVER['DOCUMENT_ROOT']."/relative/path/to/my/include.php");
?>

These three lines should begin at the very left-hand side of your file with no leading spaces or tabs.
« Last Edit: June 20, 2011, 08:00:11 AM by kai »