I have an error message appearing in the header section of my site and don't know what's the reason for that. It seems like a bug but I don't know the reason and how to fix that!
It appears that your site is trying to set something on the header (perhaps a cookie) after the response was sent. We need to see the code responsible. Most likely you need to move some of your code around in your file (perhaps the thing on line 8 should be before the thing on line 1?)
The reason is present in the error message itself; headers cannot be set after output has been sent to the browser. When PHP first outputs any actual content to a browser, it has to send the HTTP headers first. After the headers has been sent, any new headers can't be added to the response, as the HTTP protocol now is in the actual body of the response. The error message shows you which line started the output (line 1), and which line tried to set the header (line 8).
To avoid the issue you can use ob_start
and output buffering, although I'd strongly suggest separating displaying HTML from the code setting the headers, by either using a template language such as Smarty or twig, or a more extensive framework with a complete MVC model.