Problems, need help? Have a tip or advice? Post it here.
15 posts Page 1 of 2
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 -

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.
Strange, this same thing happened to me right now.But everything was working fine, and i didn't messed with any encoding properties, that warning(headers already...) just popped out of nowhere.

Will try this solution now.
Edit: Great, the solution provided worked.
I am doing an English and Arabic site and while everything else is perfect, this Cannot modify header information constantly appears at the top. Tried this fix above but it didn't work. What to do?
I recently encountered another instance of this problem. This time the culprit turned out to be the kfunctions.php (used for 'shortcodes' as explained at http://www.couchcms.com/docs/miscellane ... codes.html).

The kfunctions.php in question had the following problems -
1. There was space (newlines) above the opening <?php statement.
This statement should always be at the very beginning of the file.

2. The end of the file had the closing php ?> block.
This statement actually should not be put in any PHP file because any space after it would be, like above, returned as content to the browser thus leading to the 'Headers already sent' problem.

I think it would also be a good idea to ensure that the kfunctions.php does not carry the BOM markers too.

Could you please check if this is not what is causing the problem with your site?
If this does not help, and your site happens to be publicly available, you can PM me your FTP/Couch creds and I'll try to figure out what might be going wrong.

Thanks
Just had the same problem to add Couch to a Cart script.

Solved it with a
<?php ob_start(); ?>

right before the Doctype
@All:

The simplest way of solving the problem, as shown in the image below, is explained in the steps below the image:

warning.png
warning.png (34.67 KiB) Viewed 52801 times


Solution:
1. Open your hosting account (e.g.: http://www.sitename.com/cpanel) and goto the File Manager
file_manager.png
file_manager.png (51.98 KiB) Viewed 52801 times


2. Navigate to the .php file that is showing the warning (e.g.: http://www.sitename.com/index.php) and Right click it, select "Code Edit".
code_edit.png
code_edit.png (56.24 KiB) Viewed 52801 times


contd.. (As only 3 attachments per post are allowed)
Image
where innovation meets technology
3. In the "Code Editor" you will see a lot of space before the boilerplate for including couch. Just remove it. and hit "Save Changes".

space.png
space.png (43.36 KiB) Viewed 52800 times


no_space.png
no_space.png (17.74 KiB) Viewed 52800 times


4. Visit the Site page that was showing the warning, REFRESH it and "Voila" the warning will be gone!!!
done.png
done.png (28.68 KiB) Viewed 52800 times


i know it may sound absurd... But next time you face the problem, just give this method a try and see...

In order to test just insert the spaces in front of the Boilerplate on any .php template and save it, refresh the page once again, u will see the error...

Regards,
Aashish Handa
Image
where innovation meets technology
Thanks for sharing your solution, Aashish.

You said
i know it may sound absurd...

Not at all! I had mentioned it as a cause for this error
1. There was space (newlines) above the opening <?php statement.

In fact, having spaces or newlines before the opening <?php would be the most visible cause. The BOM bytes are more difficult to troubleshoot as they don't have a visual appearance and yet are treated as content by the webserver.

Thanks again :)
Welcome KK Sir!!!

As a matter of fact, whenever I get this warning, I always do the above process and the problem is solved in a jiffy!!!

Once again Welcome sir... I hope this graphical representation of the problem solution will come in handy, for others who will start using couch!!!

CouchCMS and KK Sir Rock!!!

Regards,
Aashish Handa
Image
where innovation meets technology
I am having an issue with this. In the admin panel there are warnings being shown behind the panel about functions being undefined or deprecated, and when I try to open kcfinder there are more warnings about headers already being sent and in the console it says that XmlHttpRequest is deprecated. I have tried converting to UTF-8 without BOM with Notepad++ and I have looked for empty space before the <?php call and I removed the ?> at the end if there was one. Anyone have any ideas? I could really use the help. Thank you in advance.
15 posts Page 1 of 2