Hi Tyrone,
This error can occur when you try the execute the header() function, or a
session_start() function AFTER information has already been sent to the
browser.
The sent information can be anything from HTML code, to whitespaces.
Example:
----- code ------
<html>
<body>
<?php header("Location: /index2.php"); ?>
.....
----- /code ------
Another common pitfall is an included PHP file has whitespace at the end.
Example:
----- code ------
<?php
echo 'foo';
?>
[white space here]
----- /code ------
The general consensus to eliminate the whitespace at the end of a pure PHP page
is to omit the closing PHP tag (ie: the '?>' ).
It's a 'standard' recommended by the Zend Framework community, even though the
early Zend Framework supported IDE's still included the trailing tag in their
templates.
If you are unable to track down the exact line of code and need a work around -
use ob_start() to negate it - BUT, it's still a better option to find the issue
rather than ignore it :)
~ C
-----Original Message-----
From: Tyrone [mailto:[email protected]]
Sent: Tuesday, 24 November 2009 11:28 a.m.
To: NZ PHP Users Group
Subject: [phpug] error: Warning: Cannot modify header information - headers
already sent
Hi everyone,
If anyone can please help me. I created code that works on my
localhost wamp setting. When I deploy it on the lamp web hosting, this
error occurs: "Warning: Cannot modify header information - headers
already sent". Any ideas on how to fix this?
Tyrone
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]
--
NZ PHP Users Group: http://groups.google.com/group/nzphpug
To post, send email to [email protected]
To unsubscribe, send email to
[email protected]