New problem with common.inc

divrom - January 18, 2006 - 10:31

(I posted this on the civicspace forum a few days ago, but I'm eager to get it sorted as the client is waiting for their site. I'm also not sure what forum section this properly belongs in.)

I've no idea why this problem has just started, but when I edit or delete a node (edit: or load a page), I now get the following warnings:

warning: Cannot modify header information - headers already sent by (output started at /home/...includes/common.inc:1) in /home/...includes/common.inc on line 99.

warning: Cannot modify header information - headers already sent by (output started at /home/...includes/common.inc:1) in /home/...includes/common.inc on line 192.

Here's what I've done recently:

* Tried to install the categories module, but it wasn't working properly.
* Uninstalled that module and installed taxonomy.
* Started using taxonomy but then I noticed this problem.
* Uninstalled all modules, but problem persists.

I've tried this with cache on and off and nothing seems to make any difference. Sometimes now even the pages that load have an initial warning, but the page soon loads over that.

I've tried removing any white space from the end of common.inc, but still no luck.

If it makes any difference, there doesn't seem to be any problems when I'm not signed-in. However, the moment I sign-in the page shows the warning aboves, before loading the page. And, if I try to edit or delete anything the warnings above appear and the page doesn't load.

Also, I just edited something and received this message:
'This content has been modified by another user, unable to save changes.'

Just to reiterate:

* The problem is more noticeable when I am signed in
* I now have no modules turned on and it still occurs
* This is only a recent problem (that occurred after I installed sections, then uninstalled it and installed taxonomy.)

I was about finished with a site I'm building for someone, but now the whole thing is on hold and nothing I am doing is working. :-?

What are the actual headers?

varunvnair - January 18, 2006 - 10:57

Observing the actual headers when this occurs will help you know where exactly this problem occurs. You will have to watch headers sent/received by your browser.

You could use the firefox extension LiveHTTPHeaders for this or sniff HTTP traffic using a sniffer such as Ethereal.

My Drupal-powered Blog: ThoughtfulChaos

Thanks for the response

divrom - January 18, 2006 - 11:33

Do you mean this:

Date: Wed, 18 Jan 2006 11:27:12 GMT
Server: Apache/2.0.54 (Red Hat)
X-Powered-By: PHP/4.3.11
Expires: Sun, 19 Nov 1978 05:00:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Last-Modified: Wed, 18 Jan 2006 11:27:12 GMT
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html

200 OK

seems like I overestimated LiveHTTPHeaders's capabilities

varunvnair - January 18, 2006 - 12:36

We need to see more of the HTTP traffic not only the HTTP headers. Is this the header sent by the offending page? Can you paste all the headers sent back and forth during the connection?

However I am getting the feeling that this is not a nice way to go about troubleshooting this issue

Try replacing your common.inc with a fresh unmodified one. Maybe the problem will just go away...

My Drupal-powered Blog: ThoughtfulChaos

I had the same idea - but now worse!

divrom - January 18, 2006 - 13:23

Varun, I must have been doing this as you were typing. However, after replacing common.inc I now receive the following error:

Fatal error: Cannot redeclare check_url() (previously declared in /home/...bootstrap.inc:545) in /home/...common.inc on line 630

I then tried replacing bootstrap with a fresh version and I now get:

warning: Cannot modify header information - headers already sent by (output started at /home/...common.inc:1) in /home/...common.inc on line 99.

warning: Cannot modify header information - headers already sent by (output started at /home/...common.inc:1) in /home/...common.inc on line 99.

Fatal error: Call to undefined function: filter_xss_bad_protocol() in /home/...common.inc on line 631

The bad news is that I'm at work and I've just realised that I don't have my USB pen (with my back ups) with me! Doh!

you seem to have mixed up versions

varunvnair - January 18, 2006 - 13:38

I think you have mixed up files from different versions. Make sure you overwrite the old files with new files with the same version as the old files (Am I making sense?)

My Drupal-powered Blog: ThoughtfulChaos

The versions merely reflect my mind!

divrom - January 18, 2006 - 16:27

I've tried a few versions, but no change.

I'll leave this till I get home (I should be working anyway!). I may then simply replace all of my files with the back-ups.

It's definitely a file problem isn't it? Not a mysql problem?

Thanks for the help, everyone. I'll let you know if the back-up restore doesn't sort it.

May not be common.inc

dman - January 18, 2006 - 11:53

Note, the usual Headers already sent problem is not neccessarily CAUSED by common.inc, it's DETECTED by it because one of the libraries loaded previously output some whitespace.
common.inc is just doing the complaining because it cannot now accurately set_header().

Your problem will almost certainly be whitespace in one of your recently modified files.

Very good description of your situation however - the symptoms are helpful, thanks.

You'll get inconsistancies when logged in because of caching. Authenticated users get fresh pages all the time. Anon users get recycled ones UNLESS they need to be made from scratch. Making a page may trigger an error (until you fix it) but the correct page will be saved anyway regardless of error, thus next time you try, the correct cached one will be served and the error will have appeared to vanish.

I randomly go into mysql and DELETE FROM CACHE; every so often just for the hell of it.

.dan.

http://www.coders.co.nz/

Seems to me that problem is with common.inc

varunvnair - January 18, 2006 - 12:36

output started at /home/...includes/common.inc:1

Doesn't this mean that common.inc itself has already sent some output and therefore later on it cannot send any more headers?

My Drupal-powered Blog: ThoughtfulChaos

Opening tag

Steven - January 18, 2006 - 12:59

Most likely there is something before common.inc's <?php tag on the first line. Whitespace, a linebreak or perhaps a UTF-8 byte order mark.

--
If you have a problem, please search before posting a question.

No whitespace before the tag

divrom - January 18, 2006 - 13:15

Thanks for the suggestion, Steven, but there's nothing before the openning tag.

Maybe its a character that is not visible

varunvnair - January 18, 2006 - 13:19

Maybe its a character that is not visible. Just like the non-printable characters in ASCII. Delete the 1st line of common.inc and just type in whatever was there. That should solve the problem if it was due to a non-printable character.

My Drupal-powered Blog: ThoughtfulChaos

Praise ma sweet Lord!

divrom - January 18, 2006 - 21:08

Thanks for all of the help everyone.

I got home and uploaded my backed up copies of common and bootstrap and we are now back in business!

Thanks again.

Had to copy hole common.inc into new file and save it

alex_b - April 6, 2006 - 20:59

Opening common.inc in UltraEdit32 on Windows and changing it (i. e. adding a whitespace in an already existing comment) consistently resulted in the above "headers already sent in..." error.

The solution was to open common.inc, copy all its contents into a new file and save it over the original file.

I suppose the reason for this error was untidy conversion from UNIX to DOS file format.

I still would like to know the backgrounds of this ominous "header already sent..." error. I have come across it frequently, every time causing a nasty search for miraculous reasons.

Can anyone explain the backgrounds of the "headers already sent" thing, or where can I find further reading?

Thanks, Alex

A solution? the UTF BOM signature

z.stolar - March 3, 2006 - 11:03

After having read one of the comments here, about non-printable characters, I remembered I added a UTF signature to my template.php, so it will open with the right encoding in my dreamweaver.
I also got the headers sent message, but after taking the signature off - no more problems!
Yippi!!!!!

 
 

Drupal is a registered trademark of Dries Buytaert.