Header Already Sent Error – How To Fix It!
One of the most nagging and irritating problem being reported by many bloggers is the “Warning: Cannot modify header information – headers already sent by (output started at path/)” error.
This happens for a number of reasons and the major cause of this problem is blank spaces/lines within a specific file as indicated by the warning.
Lets have a look at an example:
Warning: Cannot modify header information – headers already sent by (output started at path/wp-includes/classes.php:1597) in path/wp-includes/pluggable.php on line 865
As we can see from this error the warning is telling us that the problem is in the classes.php @ line 1597 and its having an effect on the pluggable.php on line 865
This can be easily remedied since the warning has already told us what the problem is and which file is being affected. So now what we need to do is inspect the error location, in this case its line 1597 of the classes.php.
How to fix the problem:
Download the file to your desktop and open it with an editor that has numbering, I use the PHP Editor (You can get a free copy here). – Now locate the line in question and take a look at it, its always good to have a copy of the original file for comparison.
In this case the problem is right at the end of the file where line 1597 has nothing in it. This tells us that it’s the classic “blank” spaces/line issue and all you have to do is delete it and save the file. The best way to do this is to place the cursor on the last > located after the ? mark, it looks like this ?> and delete it, hold down the delete key for about 10 seconds. Release the delete key and add the > back, now do nothing else other than saving the file.
Re-upload to your server, reload your web page and hopefully that should have fixed the problem and your site should be back up and running.
If you find this post helpful please tell others, if I’ve got it wrong please tell me – leave a comment.
If you have a specific problem and want it looked into,send me an email via the contact us form.





Interesting and informative. But will you write about this one more?
@Cornelius – The topic is pretty much covered, but I will be writing up some more on other types of errors. If you have a nagging error you want addressed let me know and I’ll be sure to put up a solution to it.
I really like your blog and i respect your work. I’ll be a frequent visitor.
@Bunker – Thank you and look forward to see you back soon
In truth, immediately i didn’t understand the essence. But after re-reading all at once became clear.
@Kouba – Am glad it made sense. To be honest with you in the begining I couldn’t grasp it either, but when I went through it over again I got the jist of the problem and dealing with them in real situation increases the knowledge.
Despite I have deleted the spaces / lines before in the files wp-settings.php and wp-config.php still have the error:
Warning: Cannot modify header information – headers already sent by (output started at myurl/wp-settings.php:1) in myurl/wp-includes/pluggable.php on line 865
@Revolweb – I’ve just had a look at your site and it seems ok, unless the problem is with another site?
You might want to clear your browser’s cookies and cache then refresh the page. Also check your plugins, try deactivating (especialy if you have the wp-cache installed) them and then refresh the page.
@Zulfikar – Sorry,
the correct url is http://www.revolweb.it/blog
@Revolweb – I can see that one too, using the Colourise theme right?
There’s a fe characters at the top of the header next to the share this button but no error. Can you deactivate the share this plugin to see if the characters go away please?
Hey, I have the same error though I’ve started the session on the first line of my php coding. I tried out the same in a trial module and it worked properly. Please help me out, my whole work has been stopped due to this error.
@kartik – Am unable to see your site @ infomasti, is that where the problem is?
My apologies, I expressed myself badly!
Sorry, sorry, sorry.
This is my problem.
I can not access admin area of my blog.
The error listed at the URL: http://www.revolweb.it/blog/wp-admin/ is “Warning: Cannot modify header information – headers already sent by (output started at /home/mhd-01/www.revolweb.it/htdocs/blog/wp-settings.php:1) in /home/mhd-01/www.revolweb.it/htdocs/blog/wp-includes/pluggable.php on line 865″
and the error listed at: http://www.revolweb.it/blog/wp-login.php/ is “Warning: Cannot modify header information – headers already sent by (output started at /home/mhd-01/www.revolweb.it/htdocs/blog/wp-settings.php:1) in /home/mhd-01/www.revolweb.it/htdocs/blog/wp-login.php on line 290″ and “Warning: Cannot modify header information – headers already sent by (output started at /home/mhd-01/www.revolweb.it/htdocs/blog/wp-settings.php:1) in /home/mhd-01/www.revolweb.it/htdocs/blog/wp-login.php on line 302″
I upgraded WordPress to version 2.8.4 while created the blog, so I’m not sure if that errors are dependent from version or any plugins (I use Php 5.2).
On frontend this blog works perfectly.
I have deleted the spaces/lines before in the files wp-settings.php and wp-config.php and still have the errors. I increased the memory used to 64 MB in the file wp-settings.php ( ‘WP_MEMORY_LIMIT’, ’64M ‘) as suggested by my hoster (Tophost.it).
Thanks and apologies
@Revolweb – No problem I see the error now but the good thing is you can still login. I suggest logging in then deactivating all the plugins. Anf that does not resolve the problem then recheck the wp-settings this time at the bottom to make sure there are no extra lines there, do the same for wp-config file if it has ?> php closing bracket then make sure there are no extra lines after it.
Another file that you will need to check is the funsctions.php in the wp-includes file, again look for blank spaces/lines at the top and bottom and delete them if any.
Hope that resolve the problem for you. If not, let me know and I’ll take a look at it for you.
I have a similar issue, but my problem is that I cannot find the file that is causing it.
And what’s more, it only happens when I don’t put ‘www’ before my domain. If I use ‘www.’ it works fine.
Here’s my error: Warning: Cannot modify header information – headers already sent by (output started at /home/content/59/4437559/html/index.php:2) in /home/content/59/4437559/html/wp-includes/pluggable.php on line 865
There are many index.php files but there is no /home/content/59/4437559 folder. I’d be happy to give you ftp access if you needed it to help me with this.
@San Diego Wedding DJ – Sure I can take a look at your site and see what can be done. Most likely it just needs a rewrite rule to redirect one URL to the other.
You can send the details via the contact us form.
Thanks for the tips this help me overcome this issue. Great article.
@Wedding Vendor Directory – You are most welcome, glad to have helped.
Don’t think I’ve come across this error yet, but now I know what to do if it ever does happen. Thanks.
This is great stuff but what php editor can I use with my Mac? All the ones I read about are for Windows.
@sandiegoweddingdj – There are a few PHP editors for Mac. TextMate (http://macromates.com) and Coda (http://www.panic.com/coda/) seem to be the most popular – hope you find them useful for your purpose.