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


- Upload and replace.
You are adviced to make backup of any files you edited.
Don't miss any post. Subscribe to Hongkiat's RSS feed now.







Comments
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
ReplyEric 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.
ReplyMarian 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!
ReplyHeyGabe April 12th, 2008
Rock on! “chances are you have messed up your wp-config.php leaving some unnecessary spaces inside.”
Exactly!
Replydanielgbr 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
ReplyWhat should I do!? I am totally a newb at this… thanx in advance
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.
Replykarol June 22nd, 2008
it doesn’t work… :/
ReplyJane Trimmer June 24th, 2008
Thanks a lot for this! It was a great help and solved my problem.
Jane
Reply_Gian July 14th, 2008
Thank you, you solved my problem.
Reply