开发者

COOKIES and "Cannot modify header information"? [duplicate]

This question already has answers here: Closed 11 years ago.

Possible Duplicate:

Warning: Cannot modify开发者_如何学JAVA header information. Can't find error

a tough question. :)

I have a php script that upon a form submit verifies username and password against a DB and, if they're OK,

setcookie("call_admin_uin", $login , $expire);
setcookie("call_admin_pass", $password , $expire);

There is NO html before that. Nothing is echo-ed out and it works fine on my localhost and on one other server. Yet, when I upload it to my main server it gives out this:

Warning: Cannot modify header information - headers already sent by (output started at /home7/pnstatsc/public_html/admin/index.php:6) in /home7/pnstatsc/public_html/admin/index.php on line 72

Warning: Cannot modify header information - headers already sent by (output started at /home7/pnstatsc/public_html/admin/index.php:6) in /home7/pnstatsc/public_html/admin/index.php on line 73

So I guess there could be something wrong with the server setting... any idea what it might be?

Thanks!


You probably have some whitespace before an opening <?php somewhere. First, I would see what the output of headers_list() is -- that will tell you which headers have been sent, then I would go through and see what headers_sent($filename) and, if necessary, headers_sent($filename, $line_number).

If you're desperate, then you can always use ob_start and buffer your output, but that is overkill.


There must have been some output.

You can use headers_sent to track down the file and line where headers have been sent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜