Warning: Cannot modify header information – headers already sent by

I just moved NFL blogs to another host and everything went well but while upgrading plugins I started to see following error:

Warning: Cannot modify header information – headers already sent by (output started at /home/../public_html/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:4711) in /home/../public_html/wp-includes/pluggable.php on line 897

Warning Cannot modify header information - headers already sent by
Warning Cannot modify header information – headers already sent by

First I thought it is file/folder permission issue, so I changed the permissions but still didn’t solve. then I try to reinstall WordPress but no success either.

I’ve moved over hundredss of WordPress blogs  and I don’t see such error quite often. So this error baffled me a little bit.

Then I decided to debug the code.

If you see the error message
/home/../public_html/wp-content/plugins/all-in-one-seo-pack/aioseop.class.php:4711

You will see that it comes from file aioseop.class.php file. When I checked /public_html/wp-content/plugins/all-in-one-seo-pack/ folder I found a zombie file – aioseop_options.php with file size 0.

This was weird. My first guess was that this file is not needed and somehow it was not deleted when I upgraded All in SEO pack plugin. So I deleted this file and everything is fine now.

So the solution for such problem is to delete aioseop_options.php file from /wp-content/plugins/all-in-one-seo-pack/ folder

You might not always see only one error as I’ve mentioned above but you might see a lot of errors coming from other files as well. But as soon as you see that this is All in SEO pack plugin involved in the error then deleting aioseeop_options.php file might be the solution.

I verified other WordPress installation and couldn’t find this file so my assumption is that this file is not needed any more in latest version. May be this file was not deleted during upgrade and hence error.

Another Solution

The solution explained above might not be the correct solution, or may be it just worked once for me, or may be I got it wrong.

Another problem is that in some files you have got spaces after closing ?>

So the solution is to open the file which you see in the error go to last closing ?> put cursor there and hit Delete key (keep it pressed) till all spaces are removed.

Once you fixed this in one file it might popup in another files, do the same for all files. My guess is after 2-3 files it should go away. If not then you have to do it recursively in all files using any editor such as Dreamweaver.


Comments

5 responses to “Warning: Cannot modify header information – headers already sent by”

  1. Hazel Avatar

    I just installed a wordpress blog and saw following error while upgrading a plugin:
    “Warning: Cannot modify header information – headers already sent by”

    I don’t use any all in seo plugin.

    Do you know how to fix it?

    1. You have got empty spaces after closing ?> in the files which show up in the error. You need to remove those empty spaces to solve it.

  2. Ed Alexander Avatar
    Ed Alexander

    Also another area to check is caching plugins. Was getting the same error and it had to do with W3TC being temporarily deactivated while i was working on something on my site where i did not want to have to empty my cache every time i made a change. So by activating W3TC and clearing my cache i was able to resolve this. Unfortunately for me i thought it was a problem with the coding i was working on so after rewriting the code 10 million times and right before i threw my computer out the window i decided to look at any plugins that could be breaking the code i was working on. The code contained a combination of a form based on SESSION and was also making a MySQL query at the same time. the php error threw me off for a quite a long while until i realized that this had something to do with cache or corrupted cache even though the direct error indicated an object flush problem and looked like a direct SESSION problem. agravating as h3ll.

  3. Edward Beckett Avatar
    Edward Beckett

    This problems often happens when WP directories or files (plugins too ) are first downloaded to a windows box, decompressed and then transported to a linux box …

    Windows converts line endings which in turn adds lines to the EOF …

    The best solution I’ve found is to:

    A) Use wget to transport the files directly to the server
    B) Keep the files tar’d or rar’d until they’re on the server … and the untar or unrar them …

  4. digitalpbk Avatar
    digitalpbk

    The cause and more solutions of this problem is explained well by me at digitalpbk.com/php/warning-cannot-modify-header-information-headers-already-sent

Leave a Reply

Your email address will not be published. Required fields are marked *