Cannot Modify Header Information An Oft Found Error
Cannot Modify Header Information An Oft Found Error
Generating of web pages is done by PHP which is a method used for dynamic web page delivery and service. Many a time an error is seen to happen when these files are to be delivered from the server and the error message will read cannot modify header information.
Any page including the web page will have two parts the header and the body. The header is the one that gives information about the server, page, related cookies, etc. This is actually important information which helps you get an insight into the topic and the web page but the users do not consider it important.
Programmers tend to change the header value. Usually the header comes first from a web server to a response and there is a separation by one blank line from the body. When the user redirects a browser to a different web page then this error can be sited. And this can be due to a white space outside the PHP start and end tags. You need to be careful to see there is no such space then the error cannot modify header information will not be seen.
When it is processed by PHP an echo statement will be turned out and a blank line will be printed. This is your culprit that showed you the error message and needs to be rectified. This is not easily noted though and you will not find an easy solution at first. Also you may be thinking it is a bug and try to find solution to remove the bug which cannot be found as it is not a bug in the first place.
In actuality it is easy to find any solution if you know where the error has occurred. But most of the time you would be beating around a bush and would assume things, thus you may be complicating the matter. With a little care you may notice the closing?> tag at the far end of your files in the php mode. This has usually no purpose at all. It can be removed easily and doing so it will not prevent the headers that are additional from being sent.
Another method of removing the error is to remove the print or a statement that prints something on a page. Thus it will enable you to remove the error and you will be able to modify the header as you want it to be and no error will occur even if you have made changes.