RSS Subscription Error Warning: Cannot modify header information...

Discussion in 'PHP' started by PHP_StevenE, Feb 8, 2008.

  1. #1
    A site that I am helping to administer is getting a RSS subscription error:

    Warning: Cannot modify header information - headers already sent by (output started at /home/sitename/public_html/wp-blog-header.php:3) in /home/sitename/public_html/wp-rss2.php on line 8

    When I go to the wp-rss2.php file view (not Edit) this is what is there:

    01: <?php
    02:
    03: if (empty($wp)) {
    04: require_once('wp-config.php');
    05: wp('feed=rss2');
    06: }
    07:
    08: header('Content-type:text/xml; charset='.get_settings('blog_charset'),true);
    09: $more = 1;
    10:
    11: ?>

    Line 8 seems to be ok.
    Let me know if you need to see more of the wp-rss2.php file.

    This is what is in the wp-blog-header.php file view

    01: <u style="display:none;" id=pizdenka>
    02: </u>
    03: <?php
    04:
    05: if (! isset($wp_did_header)):
    06: if ( !file_exists( dirname(__FILE__) . '/wp-config.php') ) {
    07: if ( strstr( $_SERVER['PHP_SELF'], 'wp-admin') ) $path = '';
    08: else $path = 'wp-admin/';
    09: die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://wordpress.org/docs/faq/#wp-config'>We got it</a>. You can <a href='{$path}setup-config.php'>create a <code>wp-config.php</code> file through a web interface</a>, but this doesn't work for all server setups. The safest way is to manually create the file.");
    10: }
    11:
    12: $wp_did_header = true;
    13:
    14: require_once( dirname(__FILE__) . '/wp-config.php');
    15:
    16: wp();
    17: gzip_compression();
    18:
    19: require_once(ABSPATH . WPINC . '/template-loader.php');
    20:
    21: endif;
    22:
    23: ?>


    If anyone has some suggestions or recomendations I would be very grateful.

    StevenE
     
    PHP_StevenE, Feb 8, 2008 IP
  2. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #2
    make sure you have no output before header(), setcookie() and other header setting functions



    The second method consists in calling the ob_start() at the very top of the PHP script like this:

    ob_start();

    This will solve your prob

    Feel free to post your reply here

    Regards

    Alex
     
    kmap, Feb 9, 2008 IP