PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Hi guys,
I am creating a forum but I have a problem with a heading. I am sure that there is not any output(No spaces before or after "<?php" and "?>", I have a presentation layer which dows not make any mess, etc.). I wonder whether there is a way to track headers or ...
I have this error displayed:
Warning: Cannot modify header information - headers already sent by (output started at C:\Program Files\Apache Group\apache\forum\scripts\main_forum.php:1) in C:\Program Files\Apache Group\apache\forum\config\config.php on line 136
In main_forum.php I have a class which declares others and has nothing to do with the output and in config.php I create a cookie at this line(This file has only constants).
Last edited by user___ on Fri Feb 23, 2007 5:00 am, edited 1 time in total.
Hi guys,
I have solved it. The problem comes from the Encoding(weird). FIrst I had had my files encoded in ANSI. Then I decided to set them to UTF-8 and I got the problem.
Doesn anyone know why is this the case and how remove this problem?
It's likely sending the Byte-Order Mark (or BOM). It's a 2 or 3 byte string prepended to Unicode files that indicate the byte order of and/or the encoding. It's supposed to be invisible, but seems to cause more problems with UTF-8 documents in practice then it solves.
You should be able to tell your editor not to put the BOM in your file, there's a setting somewhere in mine I switched off once.
Some editors put two characters called BOM, byte order mark in the beginning of UTF8 encoded text files. They are invisible when opened with the editor, because it just uses them to tell that the file is in utf8, but PHP doesn't like them and echo-es them as output.
Try a different editor, for example Scite has file->encoding->utf-8 cookie.
I use EditPlus 2.30 and I had not had any problems before this with the encoding. I will try what you have said guys and I will tell you what the result is.