post-page

WordPress and the Headers Already Sent Warning

6
responses
by
 
on
September 16th, 2010
in
WordPress, WordPress Troubleshooting

The scenario begins like any other troubleshooting scenario. You’ve just installed a plugin or theme on your WordPress blog, modified a file, or you’re simply checking on your blog. Suddenly, an error message just like the following looms over the page you’re viewing like a dark cloud.

Warning: Cannot modify header information - headers already sent by (output started at /path/blog/wp-config.php:34) in /path/blog/wp-login.php on line 42

Remember the first rule in troubleshooting, don’t panic! First, you need to interpret the error message. Offhand, it would seem as if line 42 of the wp-login.php file was the source of the problem, but that’s a common misconception. In fact, the problem is on line 34 of the wp-config.php file, and line 42 of the wp-login.php file is just the victim.

Now that you know where to look, what do you look for? Believe it or not, this problem is usually caused by nothing more than blank space (either a single blank space or an entire blank line) on the referenced line.

Now that you know where and what to look for, access your server via FTP or SFTP and use a plain text editor to edit the file. Alternatively, if you don’t want to mess with editing the file, replacing it with an original copy may resolve the issue.

What if you don’t see anything wrong with the file, and replacing the file didn’t resolve the issue? There’s always the possibility that a plugin or theme functions file could be causing the space to appear when the file is accessed. Try deactivating all plugins. If that resolves the issue, reactivate each one individually until you find the cause. If that does not resolve the issue, try switching to the Default theme (WordPress 1.5 – 2.9.2) or the Twenty Ten theme (WordPress 3.0 and higher) to rule-out a theme-specific issue. If you cannot access your admin panel, you’ll have to manually reset your plugins and theme, which we covered before in WordPress and the White Screen of Death.

If you still have not been able to resolve the issue, the volunteers in the WordPress Support Forums will be more than happy to help you. Just be sure to fill them in on all the steps you have taken thus far.

heading
heading
6
Responses

 

Comments

  1. Tom Coburn (67 comments.) says:

    interestingly enough, I’ve had that problem before also, except the errors show up in my error.log files instead of right on the page. I didn’t think about that causing the problem. cool thanks for the tip!

  2. Inge (4 comments.) says:

    Thanks for the structured step-by-step troubleshooting approach. I’m not a programmer and tend to panic when PHP errors occur.

  3. Zak Show (5 comments.) says:

    I got this kind of errors in my blog too, but the best thing that I do to avoid these kind of problems is that i always download backups of the blog files including the templates, in that way when I install a new plugin that does not work, all what I do is to desactivate what I just activated and I upload the backup files to get everything back to normal.
    And you’re right, you just don’t have to panic, because when you see that all your hard work is messed up you get scaryy lol!

  4. Stefan (2 comments.) says:

    I fixed the problem on the wordpress installation with your little tipp here. Thanks a lot!

    Greets Stefan

  5. James Huff (62 comments.) says:

    Thanks, Aaron, I wouldn’t have though of using that. It may slow the page load down by a couple milliseconds, but it’ll certainly resolve the issue as well.



Trackbacks/Pingbacks

  1. […] WordPress and the Headers Already Sent Warning […]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php