For those of you new to PHP and those of you who haven’t run into this problem already, here are a few pointers about the Cannot modify header information – headers already sent error and some things that might work for you to fix them
There are several reasons to modify the header values, for example if you want PHP to generate XML output, you would want to modify the header information.
Often people stumble into this error when using the header() function in PHP.
Let’s look at few ways to try and fix this error.
First thing lets get some debugging output to help us
<?php
ini_set(‘display_errors’, true);
ini_set(‘display_startup_errors’, true);
error_reporting (E_ALL);
?>
Check your PHP file for whitespaces and blank lines before the <?php tag and after the ?> tag. There should be no whitespaces or blank lines outsides those tags.
Note! Dreamweaver used to addwhitespaces to .php files saved as UTF-8, but they are invisible in Dreamweaver.
You can add this line to the very start of your script.
<?php ob_start(); ?>
You can add the following line to your php.ini file
output_buffering = 4096
Check your files encoding settings.
These are the problems I’ve personally ran into with this error and hopefully this can help you if you are having the same problem.

