I just had a trouble-shooting session over my email with a user complaining of receiving a PHP warning while trying out Couch.
This could be helpful to others, hence I am posting an excerpt of our conversation -
This could be helpful to others, hence I am posting an excerpt of our conversation -
Hi
i just started putting my site into Couch and i get
the message
Warning: Cannot modify header information (headers already send..
This message is at the top of the browser window.
Is this something in the cms or is it in the server?
kind regards
Hi,
Could you send me your 'index.php' file from within which Couch is being invoked.
Hi,
here is the index.php..
Hi,
Tested your php file out on our system and there is no warning or error at all.
However, I have made a little change to the index.php you send. Please try it out on your server and let me know if it makes any difference.
Hi,
yes it made a difference, warning gone.
Is there something i need to be aware of because of this?
many thanks
Hi,
The problem was that your php file was encoded as 'utf-8 with BOM'.
This BOM (Byte Order Mark) consists of a couple of bytes before the file's content that indicate the encoding of the file.
This being invisible goes unnoticed but causes certain configurations of PHP to throw the 'headers already thrown' error.
What I did to rectify this was to load up your file in Notepad++ and from its menu, chose Encoding -> Encode in utf-8 without BOM.
If your editor does not have this facility, get notepad++. It is free and open-source.
Do let me know if you happen to have any further problems with working with Couch.