
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.
Related Contents |
Sponsors |
|
Posted by hongkiat in Wordpress, Wordpress Tips Tricks , at 12.30.07
Tags: Warning: Cannot modify header information - headers alr, wordpress error |
|

























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.
Replyblake July 24th, 2008
Hi I have the same problem as you danielgbr….I have tried many things but nothing helped…where was the problem if you were able to fix it??
ReplyJaime Creixems July 26th, 2008
I can’t believe this, I told many of my clients that I cannot sell them WP in spanish because when I change the wp-config file to put it in spanish the WP messed up.
I can’t believe this, you solved my problem, but is unbelievable that the spaces wer already there but only start messing around if I modify the file.
Thanks a lot for fixing this serious WTF
ReplyRovingCalypso August 22nd, 2008
I’ll be darned. I reinstalled the wordpress twice as I was getting this error when i upgraded.
Who could’ve thought it were the space. Lol
ReplyAnouar August 24th, 2008
Thanks, great post
i had the same problem but i jut apply this solution (delete some space) and it work perfectly.
Replypurab kharat August 25th, 2008
i solved this problem
use this code
<?
//dont use header function in wordpress-wp_signup.php
global $domain;
global $path;
//change urlnew variable as per requirment
$urlnew = “http://”.$domain.$path.”/wp-admin/admin.php;
echo “”;
Replyecho “location = ‘$urlnew’;”;
echo “”;
echo $urlnew;
?>
Purab Kharat
Beaulife September 21st, 2008
Other than wp-config.php & header.php, any other possible cause of this error? I tried to delete those spaces but still the same problem. May I have your suggestions?
ReplyBeaulife September 23rd, 2008
I just realized that the Google Analytic had created this trouble for my blog. I used to view my blog in Firefox but no error, but I found error from Google Analytic in IE. After I deactivated the Google Analytic Plugin, then all the problems solved. Just to share with all.
Replytkins recipes September 27th, 2008
thanks for letting others know. this helped me out to when i encountered the problem
Replyjen September 27th, 2008
just wanted to let you know this saved me quite a bit of time tonight… thks for posting!
ReplyGustavo D. September 30th, 2008
Resolveu meu problema! Obrigado!
ReplyAleks October 29th, 2008
So simple, and yet effective. It helped me transfering my blog.
ReplyRaj October 31st, 2008
Thank you dudes, it worked..
ReplyBoris December 3rd, 2008
It worked for me! Removed to blank rows at the bottom
Thanks.
ReplyAbs January 17th, 2009
Thanks Bro, worked a treat after i removed the blank spaces.
ReplyAndy January 27th, 2009
Hi,
I had a similar problem and found it was caused by a recent update to one of my plugins, removed the plugin and this fixed the error.
Andy
ReplyFird February 3rd, 2009
Thanks for the space tip. It’s been driving me nuts for hours!
Replycnpabi February 4th, 2009
:)
Replydoesn’t work…
Alex February 6th, 2009
Thanks, it solved the problem!
ReplyJavier February 7th, 2009
Now I can start my blog. Thanks a lot!!!!!!!!!!!
ReplyYou are the best
/Javier
Lindsey February 15th, 2009
Thanks so much, this really helped me and saved a lot of time!
ReplyBumpas March 13th, 2009
You’re my hero. Thanks. It was so simple. I didn’t even see it.
ReplyJoreel March 13th, 2009
Warning: Cannot modify header information in Wordpress
I encountered the same problem… but I fixed using these following methods..
http://emag.joreeldiaz.com/warning-cannot-modify-header-information-in-wordpress/
ReplyMike Pantoja March 16th, 2009
Holy Crap! All I had to do was check each file that showed up in the headers and TA DA! Problem solved. Thank you so much for posting this.
ReplyGirish March 16th, 2009
Hi,
When i am adding or deleting post in wordpres admin i am getting below error.
Warning: Cannot modify header information – headers already sent by (output started at /home/content/d/i/c/diclemen18/html/wp/wp-admin/includes/file.php:1539) in /home/content/d/i/c/diclemen18/html/wp/wp-includes/pluggable.php on line 850
Can anyone please help me.
Thanks
ReplyPaul March 22nd, 2009
Ja, genau so hatte ich es auch. Aber nun ist das Problem weg :)
ReplyMichael L. March 26th, 2009
Wow, no friggin wayyyy. I have tried everything……. just as well as you all have im sure. And the freakin spaces were the problem. Im not sure which file, I went through a lot of em and almost cant believe that no more errors. :-) What a relief
ReplyMartijn March 27th, 2009
Tnx! That solved it!
Replykristine April 29th, 2009
I messed up my upgrade :( Please help. I tried doing what you said here…but to no avail…I can’t login to wp-admin too :(
Warning: Cannot modify header information – headers already sent by (output started at /homepages/6/d262576222/htdocs/wp-settings.php:630) in /homepages/6/d262576222/htdocs/wp-includes/pluggable.php on line 850
Replykristine April 29th, 2009
i did it! :) figured out eventually…i had like 3 or 4 files that needed the editing and that was it :)
thanks again for this info:)
Replyjosh May 5th, 2009
Thanks for posting this, unfortunately the spaces wasn’t the problem but I saw a comment here about google analytics, so I removed the plugin and it works. thanks hongkiat & beaulife!
Replyclaudia June 3rd, 2009
You have saved my hide! Thanks a billion! Now, how tha heck did that happen, I will never know…
ReplyEnergy Care July 2nd, 2009
Thanks!! this helped a bunch!! the problem ended up being a plugin i was using…random image generator…not sure what was not working, just deleted it and now im up and running!
ReplyTG July 31st, 2009
Thanks! This was exactly the problem I had, and such a sneaky error to detect!
ReplySverre August 10th, 2009
Thanks! that was the missing info I needed
ReplyMarius August 10th, 2009
Hi, I’m having the same problem with BBPress, but theres no extra spaces in that file. Here is the errormessage:
Warning: Cannot modify header information – headers already sent by (output started at /home/michael/public_html/forum/bb-config.php:1) in /home/michael/public_html/forum/bb-includes/backpress/class.wp-auth.php on line 273
Warning: Cannot modify header information – headers already sent by (output started at /home/michael/public_html/forum/bb-config.php:1) in /home/michael/public_html/forum/bb-includes/backpress/class.wp-auth.php on line 273
Warning: Cannot modify header information – headers already sent by (output started at /home/michael/public_html/forum/bb-config.php:1) in /home/michael/public_html/forum/bb-includes/backpress/class.wp-auth.php on line 273
Warning: Cannot modify header information – headers already sent by (output started at /home/michael/public_html/forum/bb-config.php:1) in /home/michael/public_html/forum/bb-includes/backpress/class.wp-auth.php on line 273
Warning: Cannot modify header information – headers already sent by (output started at /home/michael/public_html/forum/bb-config.php:1) in /home/michael/public_html/forum/bb-includes/backpress/class.wp-auth.php on line 273
Warning: Cannot modify header information – headers already sent by (output started at /home/michael/public_html/forum/bb-config.php:1) in /home/michael/public_html/forum/bb-includes/functions.bb-pluggable.php on line 232
ReplySergey Rusak August 13th, 2009
Thank you, it was easy. It took me 3 hours to figure out untill I found your post.
ReplyRob Butz September 4th, 2009
Hi folks. Well after looking at the error info, it looks as if the issue is NOT my wp-config.php or wp-login.php files but my themes functions.php file. I removed spaces at the end of that one.
It makes sense as that could’ve been the only thing I might have modified and my site was “suddenly” not working.
So.. checking your theme files functions.php is also recommended.
Cheers
R o B
Replynabtron September 27th, 2009
the error is in the file that is being said in the error first line. this is caused by extra spaces before or after the php code
check out the explaination here:
http://tech.nabtron.com/wordpress-plugin-error-warning-session_start-function-session-start-cannot-send-session-cache-limiter-headers-already-sent-output-started-at/525/
ReplyRichard October 21st, 2009
Got to say thank you, yesterday i locked down my site, and had to make small changes in the wp-config file
any way today i had this error showing,
then
found you on google, made the small change of deleting the space
and bingo my site is now up and running correctly..
http://www.guesthousepattaya.com
Thank you
ReplyRob November 14th, 2009
Thanks a lot, I had an error after installing a new theme so I went to the file specified and there was a blank line just like you mentioned. Erased the blank line and no more problems.
ReplyJacob November 17th, 2009
This worked for me! You are awesome!
ReplyAnthony November 27th, 2009
I just downloaded the newest version of Wordpress and all I did was modify wp-config.php. There were no spaces before at the end. So i added it in and made sure there were no white-spaces. However the problem still exists, any other suggestions?
ReplyAnthony November 27th, 2009
Sorry my above post didnt show any code^^^
I just downloaded the newest version of Wordpress and all I did was modify wp-config.php. There were no spaces before”".However the problem still exists. My website shows up fine, I just get the error when i am at the wp-login.php file
Any any other suggestions?
ReplyAaron December 15th, 2009
Thanks – VERY HELPFUL!
ReplyDennis December 17th, 2009
Thanks SO much for this quick fix!!! Saved me so much time!
Replyankara boyacı December 19th, 2009
güzel paylaşım
ReplyJulianK January 15th, 2010
Thanks, this really helped me out!
ReplyLeah Virsik January 24th, 2010
Thanks for posting this! You saved me after countless hours… :)
ReplyMark Hedley February 3rd, 2010
Top tip and solved the problem. Thanks
ReplyKarl February 4th, 2010
Hey, nice article and useful comments. None of the comments helped me though. I finally found my solution buried in one line of the wordpress troubleshooting guide. “Also check the encoding of the file. If the file is encoded as UTF-8 with BOM, the BOM is seen as a character which starts the output.” (from: http://bit.ly/by8n5x). I was developing a Chinese localisation, and had inadvertently enabled the BOM in the file editor I was using. Lesson, check your php file encoding and if in doubt set it to ANSI and see if that fixes your problem.
ReplyBrad February 14th, 2010
Thanks! Fixed my problem!
ReplyAdrian February 15th, 2010
Thank you for this post. I just created my first plugin and widget, and I was receiving a similar error with headers. I removed all the unnecesary spaces in the code and now it works.
ReplyNilesh February 21st, 2010
Thanks for solution, many problem solved, my http://domain.com and http://www.domain.com/wp-admin have same error, i solved using removing space after ?>
earlier my site was hacked by ftp password compromise through ftp my hosting provider remove infected script but space after ?> was left, i solved this
thanks
Replyrob March 9th, 2010
Thanks – you are still helping people over two years later!
Replylouise March 19th, 2010
hi,
i’m stuck with this message…
Warning: Cannot modify header information – headers already sent by (output started at /mounted-storage/home95b/sub003/sc1084932-QQGK/willvandewiel.com/wp-content/plugins/google-news-widget/google-news-widget.php:1) in /mounted-storage/home95b/sub003/sc1084932-QQGK/willvandewiel.com/wp-login.php on line 302
Warning: Cannot modify header information – headers already sent by (output started at /mounted-storage/home95b/sub003/sc1084932-QQGK/willvandewiel.com/wp-content/plugins/google-news-widget/google-news-widget.php:1) in /mounted-storage/home95b/sub003/sc1084932-QQGK/willvandewiel.com/wp-login.php on line 314
i don’t have ftp set up for the site and i cant log into the wordpress acc either. completely stuck and getting grief from the boyfriend please help!!!
Thanks!
ReplyTrackbacks