Support » Fixing WordPress » Warning: Cannot modify header information – headers already sent by…

  • survivalisparamount

    (@survivalisparamount)


    Hello.
    I have installed WordPress, and made a page called blog.php. All I have in my coding for that document is the php includes for my header and footer of my site, and the “Short and Sweet” code for WordPress. However, when I go to my page blog.php, the following error message shows up:

    Warning: Cannot modify header information – headers already sent by (output started at /home/xxxx/public_html/header.php:5) in /home/xxxx/public_html/wp/wp-includes/pluggable.php on line 390

    Here is the coding on line 390 of pluggable.php:
    header("Location: $location");

    For a live example of this on my site goto:

    http://www.survivalisparamount.com/blog.php

    Any help would be appreciated. Thanks.

Viewing 15 replies - 1 through 15 (of 26 total)
  • Please, use the search function.

    This is probably a good jumping off point.

    survivalisparamount

    (@survivalisparamount)

    I did use the search and tried that earlier. There is no unnecessary whitespace on header.php, wp-config.php or pluggable.php. The error say line 5 of my header.php, but the only thing there is:

    <style type="text/css">

    No whitespace or anything.

    Make sure you check both the start and end of the file for whitespace! This has got me before…

    survivalisparamount

    (@survivalisparamount)

    I double checked all three files at the start and end for whitespace and there is none. This is really bugging me…

    whooami

    (@whooami)

    Member

    header("Location: $location"); is sending a header.

    whats on Line 5 of home/xxxx/public_html/header.php ??

    if you are sending content to the browser at line 5, you cant send headers later on.

    survivalisparamount

    (@survivalisparamount)

    On line 5 of my header.php in my root directory like stated in the error message, I just have:

    <style type="text/css">

    whooami

    (@whooami)

    Member

    thats the problem.. youre sending text, and then headers.

    what does blog.php look like exactly? paste it here

    http://wordpress.pastebin.com

    and then link to it

    survivalisparamount

    (@survivalisparamount)

    On blog.php here is my exact coding:

    http://wordpress.pastebin.com/ff2e4609

    or

    <?include("header.php");?>
    <?php
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('./wp/wp-blog-header.php');
    ?>
    <?include("footer.php");?>
    whooami

    (@whooami)

    Member

    and thats all wrong. hang on one sec, I need to post to another thread.. ill come right back.

    That file needs to look like this:

    <?php
    /* Short and sweet */
    define(‘WP_USE_THEMES’, true);
    require(‘./wp/wp-blog-header.php’);
    ?>
    <?include(“header.php”);?>
    <?include(“footer.php”);?>

    survivalisparamount

    (@survivalisparamount)

    Ok… let me try that…

    survivalisparamount

    (@survivalisparamount)

    The blog shows up, but not where I want it. I want in between my header and footer so it goes along with the rest of the site. Thanks for helping me get rid of the error though…

    Here’s the blog:
    http://www.survivalisparamount.com/blog.php

    and I wan’t it to look like this (cutenews):
    http://www.survivalisparamount.com/index.php

    whooami

    (@whooami)

    Member

    thats another issue.

    http://validator.w3.org/check?uri=http://www.survivalisparamount.com/blog.php/

    For instance there are 2 html tags.

    Without seeing the content of all those files its impossible for anyone to tell you what you need to change.

    If you look at the validator results, and look at the order that you are calling things, you ought to be able to figure it out.

    The long and short of it is that you are doing this the hard way.

    survivalisparamount

    (@survivalisparamount)

    The long and short of it is that you are doing this the hard way.

    I’m new to all this WordPress stuff; but how am I doing it the long way?

    I saw this problem and wanted to send my problem too>

    It is long and involved but hopefully you will have the patience:

    Begging for help:

    ”’I am a newbie:

    This is the error we saw:
    ”’

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/j/o/u/jou/html/biggydaddy/wp-config.php:25) in /home/content/j/o/u/jou/html/biggydaddy/wp-login.php on line 12

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/j/o/u/jou/html/bigydaddy/wp-config.php:25) in /home/content/j/o/u/jou/html/biggydaddy/wp-includes/pluggable.php on line 367

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/j/o/u/jou/html/biggydaddy/wp-config.php:25) in /home/content/j/o/u/jou/html/biggydaddy/wp-includes/pluggable.php on line 368

    Warning: Cannot modify header information – headers already sent by (output started at /home/content/j/o/u/jou/html/biggydaddy/wp-config.php:25) in

    ”’
    This is the wp-config file:”’

    <?php
    // ** MySQL settings ** //
    define(‘DB_NAME’, ‘biggydaddy’); // The name of the database
    define(‘DB_USER’, ‘biggydaddy’); // Your MySQL username
    define(‘DB_PASSWORD’, ‘[mod sighs…]‘); // …and password
    define(‘DB_HOST’, ‘p41mysql33.secureserver.net’); // 99% chance you won’t need to change this value
    define(‘DB_CHARSET’, ‘utf8’);
    define(‘DB_COLLATE’, ”);

    // You can have multiple installations in one database if you give each a unique prefix
    $table_prefix = ‘wp_’; // Only numbers, letters, and underscores please!

    // Change this to localize WordPress. A corresponding MO file for the
    // chosen language must be installed to wp-content/languages.
    // For example, install de.mo to wp-content/languages and set WPLANG to ‘de’
    // to enable German language support.
    define (‘WPLANG’, ”);

    /* That’s all, stop editing! Happy blogging. */

    define(‘ABSPATH’, dirname(__FILE__).’/’);
    require_once(ABSPATH.’wp-settings.php’);
    ?>

    ————————————————-
    Also: When I try to bring up the site. The Blog comes up instead

    I want the site to be up not the blog

    I had a problem with the “headers already sent” too at my http://www.Maxi-Pedia.com website. In my case, it was caused by a blank line at the beginning of one *.inc file. PHP seems to have problems with extra spaces here and there.

    Check all your *.inc files to make sure you do not have closing ?> in any of them. Closing ?> is not needed in your *.inc files. Check all your *.php files to make sure you do not have blank lines at the beginning or at the end.

    If you are working in a CMS, then it may be caused by some module, disable your modules one by one to find out which one causes this.
    This can also be caused by UTF-8. If you have your website coded in ASCII and are saving your php files as UTF-8, it can cause this message. If your website and DB are UTF-8, you should be ok with saving php files as UTF-8 though.

    Btw, this error message is related to output_buffering on/off in your php.ini. If you have output_buffering set to some cache, the server will allow to send headers with delay (or to modify them shortly after they are sent), and this error will not be tripped. But if you set output_buffering to 0 or not at all, then headers can be sent at only one moment, and if you have some bad code, it will trip this error message.

Viewing 15 replies - 1 through 15 (of 26 total)
  • The topic ‘Warning: Cannot modify header information – headers already sent by…’ is closed to new replies.