WordPress.org

Forums

"Cannot Modify Header Information" ... help? (8 posts)

  1. shycircus
    Member
    Posted 7 years ago #

    I have been attempting to help a friend fix a problem she has been having with wordpress. With each site she has installed wordpress on she is recieving this error when attempting to make the news show on her site:

    "Warning: Cannot modify header information - headers already sent by (output started at /home/.mowp/annaleigh/annaleigh.sweetgiggles.net/header.inc:101) in /home/.mowp/annaleigh/annaleigh.sweetgiggles.net/updates/wp-includes/pluggable.php on line 689"

    EG. http://www.annaleigh-ashford.com/

    Does anyone have any suggestions on how to rectify this?
    Thankyou in advance.

  2. mechx1
    Member
    Posted 7 years ago #

    pluggable.php is calling a php function HEADER that can send an HTTP header to ther browser. The most common use is to tell the browser to redirect to some other page. You can't use this function after ANY output has been sent to the browser, including just <html>. Output has already been started by header.inc

    I have seen this sort of thing happen when not all of the files were upgraded, are these upgrades or brand new blogs?

  3. shycircus
    Member
    Posted 7 years ago #

    Thanks for the reply.
    I believe they are all new installations of wordpress.
    Do you have any idea how I can stop this problem from occuring?

  4. mechx1
    Member
    Posted 7 years ago #

    Are you calling a plugin to display this news, and does the error go away when you de-activate it? Is it compatible with your release of WordPress?

  5. habanero
    Member
    Posted 7 years ago #

    I just had this issue after an upgrade and it wasn't really the upgrade, it was that pluggable.php is a newer file that didn't previously exist. To fix it I had to comment out the code that tries to load the header in pluggable.php.

    The issue was because a plugin had already made the call. You can try turning off all the plugins and seeing if the error stops, if it does turn on one plugin at a time until you generate the error, then look for a newer version of the plugin. Alternately you can comment out the code as I did.

    /*
    function wp_redirect($location, $status = 302) {
    global $is_IIS;

    $location = apply_filters('wp_redirect', $location, $status);
    $status = apply_filters('wp_redirect_status', $status, $location);

    if ( !$location ) // allows the wp_redirect filter to cancel a redirect
    return false;

    $location = wp_sanitize_redirect($location);

    if ( $is_IIS ) {
    header("Refresh: 0;url=$location");
    } else {
    if ( php_sapi_name() != 'cgi-fcgi' )
    status_header($status); // This causes problems on IIS and some FastCGI setups
    header("Location: $location");
    }
    }
    endif;
    */

    There are many things in pluggable.php that may need to be commented out, depending on the plugins, and what calls they make.

    No gaurantees here, this just worked for me.

  6. mechx1
    Member
    Posted 7 years ago #

    I think it would be better to examine the plugin in question and find out why it is not compatible. pluggable.php is written in such a way that a plugin can declare its own function wp_redirect, and write that function such that it does not call HEADER("Location: $location); The fact that this was not done would indicate an incompatibility in that plugin which needs to be addressed for good stability.

  7. Jeremy Clark
    Moderator
    Posted 7 years ago #

    Also editing of core WP files is discouraged. This also makes upgrades a hassle.

  8. moshu
    Member
    Posted 7 years ago #

    Also, let's have a closer look at the error message posted by the OP:
    home/.mowp/annaleigh/annaleigh.sweetgiggles.net/header.inc:101)
    It clearly indicates that a non-WP file is causing the problem, namely the "header.inc"! In its line #101 there is something that conflicts with the WP code.

    Remove temporarily that file. Does it solve the issue?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags