I have just uploaded some new PHP
code onto my live server and I am now getting the classic "Cannot modify header information - headers already sent..." error. It worked perfectly fine on my local WAMP
server.
The server error log shows this:
[30-Jan-2014 03:29:28 America/New_York] PHP Warning: Cannot modify header information - headers already sent by (output started at /home/donald/public_html/admin/process/itemMgmt.php:12) in /home/donald/public_html/includes/functions.php on line 158
Line 8 through 15 in itemMgmt.php
is this:
require("../wideimage/lib/WideImage.php");
$url = $_POST['url'];
$name = str_replace(' ','_',$_POST['name']);
echo "GIVEN NAME: " .$name. "<br>";//Error Checking
$loc = $_POST['loc'];
echo "LOC: " .$loc. "<br>";//Error Checking
And line 154 through 161 in functions.php
is this:
function redirect_to( $location = NULL )
{
if ($location != NULL)
{
header("location: ".$location."",true,302);
exit;
}
}
This process is used when I add a new item into my database and is used across multiple pages on my site. I get this same error regardless of which page I try to add a new item from.
I have searched this site and found several write ups on this exact subject, however I cannot find one where the poster had it working on a local server but not on a live one, which I believe makes this a unique problem.
I have searched to make sure there are no white-spaces before, or after, my <?php ?>
tags and found everything ok.
I'm most confused by the line numbers given in the error log, it doesn't make any sense and I can't figure out where to look next.