Wordpress 2.9 Upgrade-Header Cannot Be Modified Error

by Shoaib Hussain on December 24, 2009

in Wordpress

Haven’t slept from last evening,know why? Exams got over and was prepared to do some real blogging.

But then I am not as lucky as you or may be you are not as lucky as me, Because I have had a real tough night searching for solution of one thing and that is what I am going to tell you about.

Before I begin let me make it clear the points that I  stress upon are real worth as if I WOULD have followed them,would have been seeping tightly now (Of course with Mr Furhead(My Rat)

Things to do before you upgrade to wordpress 2.9

  1. Make a complete backup of your data base(I know it takes time and bandwidth,but then why take chances to repent later)
  2. If you are using Thesis then you surely need to make a full backup of it as well.
  3. Never ever use note pad to edit any Php codes(You will come to know in a moment what it does to your Php codes)

So you upgraded have  to wordpress and voila everything went fine and that’s it-If you fall in to this list of folks then  please do keep visiting this blog or simply bookmark this page as who knows when you may need these tips about wordpress warning messages.

And if you are from the few lucky champs who are getting these error’s

Warning: Cannot modify header information – headers already sent by (output started at /home/what/public_html/wp-content/themes/thesis_16/functions.php:1) in /home/what/public_html/wp-includes/pluggable.php on line 868

The file names (highlighted) may be different but the real culprit in this case is notepad and the error lies in your functions.php file or any file that you have edited in a note pad.

You may even not be able to login to your wordpress blog,so make sure you have a ftp client(such as fire ftp for Mozilla Firefox) or a cpanelenabled hosting.

Note:-As I Know how these error crept into my php files I have deliberately reproduced them by simlply editing these files in note pad.

Here are a couple of screen shots of a view at php(after being edited in notepad) in note and stlyemaster(Now my only coding software)

Notepad view

Don't use notepad to edit php codes

see the pink arrow-No bad codes visible

Stylemaster View

Stylemaster and php editing

Stylemater shows the hidden bad codes

As you can see these the code in the first line is visible only in stylemaster and not in notepad.

This is where I Was caught and was getting agitated.

Now here are some way’s to get rid of these wordpress errors and warnings that I know of:-

  1. Open your function.php file in a reliable coding software and remove the hidden codes as shown in the picture above.(Worked for me)
  2. Open you wp-config.php file ( located in your wordpress root directory) and remove all the spaces before php tags.

What I Mean to say here is remove any spaces including any blank lines,just press delete till you reach the opening or closing php tags.

Wordpress header cannot be changed warning

Leave NO Blank spaces before <? php

Php warnings and errors in wordpress

Leave NO space or blank lines after ?> code

Perhaps there may be many more methods to deal with this wordpress problem but these two are the only ones that don’t ask you to mess up your php codes.

After you follow these steps you may get another error from your wordpress blog,simply check the name of the first file again and remove the crap out of their.

Here I am telling you again do not use note pad to edit your .php files.

Hope this helps you and in case none of these work for you(I am sure that first one works like a charm) then please take note the of first file mentioned in the error/warning and just open it in your code editing software(not notepad)..

This is a guest post by Shoyeb. A young blogger who blogs at what-what.net. If you like to write for Shoutmeloud, do read Shoutmeloud revenue sharing program.

Related posts:

  1. Error in wordpress RSS feeds ||XML parsing Error
  2. How To Change Wordpress Default Username For Security
  3. Wordpress Fatal error: Allowed memory size Allowed memory Size
  4. Wordpress Error while Updating Wordpress
  5. Integrate Facebook Friend Connect With Wordpress Blog
  6. Customizing Thesis Wordpress Theme 404 Error Pages
  7. Wordpress introduce Videopress as an upgrade service for video hosting
  8. How to Install Buddypress in Wordpress MU


{ 10 comments… read them below or add one }

1 SmashinGeeks December 24, 2009 at 08:51

Oh this was the error , thanks for the tutorial . Now my localhost blog is working properly.

Reply

2 Chethan December 24, 2009 at 10:33

Wordpress People are So Sick! Why did They Upgrade to Such a Bad Version of Wordpress… where there are hundreds of Bugs?? I was satisfied with v2.8!

Reply

3 Ashfame December 24, 2009 at 12:06

Bugs always creep in. And people upgrade because they want more & more features. Its their choice to upgrade or run a older version. I hope by WordPress People you mean the end users and not the developers.

Reply

4 shoaib December 26, 2009 at 00:08

As i told in the post as well,that its totally a fault of your editor,so please do not blame the WP guys,they are working on a rocket science…..

Reply

5 Ashfame December 24, 2009 at 11:53

Actually you just need to make sure that there is no space before `<?php` and the last ending tag can be even left out as there is some uncertainity in debate that it actually gives some sort of performance gain.

Reply

6 Athul Jayaram December 24, 2009 at 16:19

Great Effort Harsh. Thanks for that stylemaster. I am going to use that as my default editor

Reply

7 Ashfame December 25, 2009 at 06:47

Try Notepad++

Reply

8 shoaib December 26, 2009 at 00:04

yeah Notepad++ is nice as well ,haven’t used it but heard a lot.

Reply

9 Athul Jayaram December 27, 2009 at 21:35

Right Friends…..

Reply

10 Hide January 9, 2010 at 00:18

Perfect!! My site is working!!!!!!

:D

Reply

Leave a Comment

Previous post:

Next post: