Perhaps your server is configured to have output buffering enabled by default? Check php.ini / phpinfo().

--Larry Garfield

On 11/11/2011 12:12 AM, Kranthi Krishna wrote:
Hi all,

I am missing something pretty obvious here. The PHP Manual says
"Remember that header() must be called before any actual output is
sent, either by normal HTML tags, blank lines in a file, or from
PHP.". A simple test case shows otherwise

I have the following code

setcookie("TestCookie", 'test');

nothing more nothing less.. only this code in a file

I get the output in the browser ("test") AND the cookie is set
(verified by live HTTP headers). Any ides on why this is happening ?

Linux localhost 2.6.40-4.fc15.i686 #1 SMP Fri Jul 29 18:54:39 UTC 2011 i686
Apache 2.0 Handler
Zend Engine v2.3.0,  Xdebug v2.1.2
PHP 5.3.6


PHP General Mailing List (
To unsubscribe, visit:

Reply via email to