visitor stats

Wordpress Error: Warning: Cannot modify header information

wordpress

Yesterday I was helping a reader solving his Wordpress error, so I thought I might as well write an entry, just in case we all encounter this in the future. If you ever run across this error (or warning) in your Wordpress with the message saying:

Warning: Cannot modify header information - headers already sent by (output started at //home/htdocs/wordpress/wp-config.php:1) in /home/htdocs/wordpress/wp-login.php on line 12

or something similar, chances are you have messed up your wp-config.php leaving some unnecessary spaces inside.

Solution

  1. Download your wp-config.php down via FTP (Edit directly if you have SSH access)
  2. Open wp-config with your favourite editor, and remove all spaces before "<?php" and after "?>"

    wordpress error

    wordpress error

  3. Upload and replace.

You are adviced to make backup of any files you edited.

Related Contents

Sponsors

Posted by hongkiat in Wordpress, Wordpress Tips Tricks , at 12.30.07

Tags: ,

Comments

  1. Eric Hamby January 22nd, 2008

    im getting this

    Warning: Cannot modify header information - headers already sent by (output started at /homepages/20/d159566430/htdocs/jericoinfo/wp-includes/widgets.php:2) in /homepages/20/d159566430/htdocs/jericoinfo/wp-content/plugins/BAStats/BAStats_logger.php on line 99

    and of course i cant even log in or anything. the later part changed due to the page but the widgets.php seems to be the sourse of all the trouble. i looked through the file and there didnt seem to be any problems that i can see.. any ideas?

    please help

    http://jericosystems.info

    Reply
  2. Eric Hamby January 22nd, 2008

    just letting you know i fixed it so you didnt waste your time trying to help. feel free to stop by though.

    Reply
  3. Marian Matthis April 5th, 2008

    Thanks! I was having the same problem. Somehow, I ended up with spaces after “?>”, but getting rid of them fixed it!

    Reply
  4. HeyGabe April 12th, 2008

    Rock on! “chances are you have messed up your wp-config.php leaving some unnecessary spaces inside.”

    Exactly!

    Reply
  5. danielgbr June 21st, 2008

    Hey Hongkiat! I host my blog at Bluehost, installed wordpress and installed a theme called Demure Composure. Everytime i do anything i get a Header Error… when I log out via my blog i get this error:
    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-login.php on line 202

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-login.php on line 214

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-includes/pluggable.php on line 570

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-includes/pluggable.php on line 571

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-includes/pluggable.php on line 574

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-includes/pluggable.php on line 575

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-includes/pluggable.php on line 576

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-includes/pluggable.php on line 577

    Warning: Cannot modify header information - headers already sent by (output started at /home/ibawebco/public_html/jiba/wp-content/themes/Composure/functions.php:1190) in /home/ibawebco/public_html/jiba/wp-includes/pluggable.php on line 694
    What should I do!? I am totally a newb at this… thanx in advance

    Reply
  6. hongkiat June 21st, 2008

    @danielgbr double check your header.php. See if there’s a blank newline on the top of the page. Sometimes this error creates that following warning.

    Reply
  7. karol June 22nd, 2008

    it doesn’t work… :/

    Reply
  8. Jane Trimmer June 24th, 2008

    Thanks a lot for this! It was a great help and solved my problem.

    Jane

    Reply
  9. _Gian July 14th, 2008

    Thank you, you solved my problem.

    Reply

Leave a reply