Hi,
I've been dealing with PHP for a few years now and I've never encountered a problem quite like this.
I've searched the net for an answer to my problem hoping somebody else may have encountered this, but without any luck, so I now resolve to pose the question myself.
Code:
[CODE=PHP]
<?php
$somedata="Lore m Ipsum";
setcookie("some name",$somedata ,time()+43200,"/");
?>
[/CODE]
[Please use CODE tags when posting source code. Thanks! --pbmods]
That's the everything on the relevant page. Just that. Two lines of code. No extra content or includes.
This page is not being included from any other pages and is being accessed directly.
Problem:
It doesn't work, and this is the first time setcookie hasn't worked for me without any obvious conflictions with other code. No cookie is being set.
Instead, PHP returns the following the error:
Warning: Cannot modify header information - headers already sent by (output started at /public_html/mkl/cookie.php:1) in /public_html/mkl/cookie.php on line 3
I've tried running the script over a multitude of browsers such as Firefox 1x, Firefox 2x, IE5, IE6, Mozilla, and it's the same result on all of them.
The server that the script is being executed has never given me such problems before (this is the first time setcookie hasn't worked for me like this) and as far as I'm aware has not undergone any recent changes.
The server is Apache operated and has the latest version PHP installed.
Anyone that can offer any assistance or suggestions on how I may resolve this problem would be greatly appreciated.
Thanks.
I've been dealing with PHP for a few years now and I've never encountered a problem quite like this.
I've searched the net for an answer to my problem hoping somebody else may have encountered this, but without any luck, so I now resolve to pose the question myself.
Code:
[CODE=PHP]
<?php
$somedata="Lore m Ipsum";
setcookie("some name",$somedata ,time()+43200,"/");
?>
[/CODE]
[Please use CODE tags when posting source code. Thanks! --pbmods]
That's the everything on the relevant page. Just that. Two lines of code. No extra content or includes.
This page is not being included from any other pages and is being accessed directly.
Problem:
It doesn't work, and this is the first time setcookie hasn't worked for me without any obvious conflictions with other code. No cookie is being set.
Instead, PHP returns the following the error:
Warning: Cannot modify header information - headers already sent by (output started at /public_html/mkl/cookie.php:1) in /public_html/mkl/cookie.php on line 3
I've tried running the script over a multitude of browsers such as Firefox 1x, Firefox 2x, IE5, IE6, Mozilla, and it's the same result on all of them.
The server that the script is being executed has never given me such problems before (this is the first time setcookie hasn't worked for me like this) and as far as I'm aware has not undergone any recent changes.
The server is Apache operated and has the latest version PHP installed.
Anyone that can offer any assistance or suggestions on how I may resolve this problem would be greatly appreciated.
Thanks.
Comment