Support » Fixing WordPress » A new spin on "Warning: Cannot modify header information – headers already sent"

  • I have just migrated web host and now, whenever I do almost anything on my blog, I get the above error.

    I’ve searched through the support pages and although there are many similar instances, this one seems different.

    error message is as follows – “Warning: Cannot modify header information – headers already sent by (output started at /home/brillie4/public_html/laybackandgetrich/wp-includes/general-template.php:2101) in /home/brillie4/public_html/laybackandgetrich/wp-includes/pluggable.php on line 866”

    I’ve tried editing the general template php file in Notepad, and then in HTMLKit (as someone on here suggested as it apparently sees more garbage than Notepad!?) but no dice. Most explanations seem to say the problem should be at start or end of file but they both look fine to me, and anyway, the message here references line 2101 of the php file.

    Lines 2101 in general-template look like this in HTMLKit –

    echo apply_filters( ‘wp_admin_css’, “<link rel=’stylesheet’ href='” . esc_url( wp_admin_css_uri( $file ) ) . “‘ type=’text/css’ />\n”, $file );

    ..which means nothing to me but why should it?! I haven’t changed this and wouldn’t dream of doing so… all I have done is migrate my site from a US based provider to a UK one (and maybe dropped something along the way?)

    I did add one plug-in before the move – W3 total cache – but have turned that off and am still getting the prob. So I’m guessing it must be the move that’s done it.

    Anyone any clue!?

    thanks Lucy

Viewing 3 replies - 1 through 3 (of 3 total)
  • What this error means is basically this: when you send http (web) data certain things have to be sent in a particular sequence. If you violate that sequence you can have trouble. It this case it has to do with http headers– kinda like email headers. You ordinarily never see them but they have to come first. If you send anything, even a ‘space’ character, prior to sending the headers (or try to send them twice) you get this error. So…

    When you get errors that refer to WordPress core files it can be hard to track down. It can mean several things:

    1) You are missing a file or you have a corrupted file. Since you just moved this is possible, but it is hard to say how likely it is. It wouldn’t hurt to upload clean copies of these files. Make sure not to mix files from different versions of WordPress.

    2) Something is passing bad data to a filter or action, triggering an error. If errors get sent early on, before the headers, you get an error. Hit Ctrl-U (view source) and see if there is anything at the very top of the page that might provide a clue. You may or may not see it in the normal page. This one can be tough to trace.

    Since you just moved servers, something else comes to mind. If the new server has a different version of PHP than the old one, you may be getting warnings or errors because of that. Step #2 above ought to help with find that too.

    Finally, do you debugging enabled? Check your wp-config.php for the line define('WP_DEBUG',true); If it is on, turning it off might stop the errors, but won’t fix the problem. If it is off, turning it on might help you find the problem, but could potentially make a very messy site.

    Hi there

    Thank you so much for taking the trouble to construct such a long and helpful reply.

    I must admit, I feel like looking for “bad data” is a bit of a wild goose chase – I’m not sure I would recognise bad data if I fell over on the stairs – but I think your PHP version comment is very interesting. So I went to the PHP config option in CPanel on my old web host (where I haven’t deleted the previous instance of my blog) and notice it was user-selectable. I appear to have been running php 5.2 there; whereas on my new host I don’t appear be able to select a version at all – but am apparently running php 5.3.9.!

    Does php 5.3.9 handle header information differently from 5.2 perhaps!?

    thanks Lucy

    I must admit, I feel like looking for “bad data” is a bit of a wild goose chase

    It sort of is… sometimes it is pretty obvious though.

    Does php 5.3.9 handle header information differently from 5.2 perhaps!?

    Maybe internally, but the headers have been defined for a long time. The final result should be the same. If it is a PHP version issue, more likely some other function changed and now issues a warning or error when it didn’t previously.

    The missing or corrupt file option is probably the most likely. Just re-upload the same files you downloaded from your other server. If you have a missing or corrupt file, either or both of which can happen with large transfers, that might fix it.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘A new spin on "Warning: Cannot modify header information – headers already sent"’ is closed to new replies.