Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+3 votes
in Q2A Core by

hello, i was editing some lines on theme-base.php file,and now when i visit the admin page i get a warning message...


Warning: Cannot modify header information - headers already sent by (output started at mysite.com/qa-include/qa-theme-base.php:1) in mysite.com/qa-include/qa-page.php on line 334"..


can someone please tell me the possible reason for this message and how to correct it.

Q2A version: 1.5
but its not causing any error,and all the pages are correctly rendered.Only when i visit the admin section i get this warning message.

4 Answers

0 votes

That warning message occurs if you output any content before you send headers (for redirection or content types). This includes any whitespace.

So make sure that your theme file does not include any text or whitespace before the <?php tag.

0 votes
If all other pages working, you must check changes you did. You can't check all files, because too much, but problem is 100% in files you worked/edited.

Here can be php error or more possible, as said previous, this is problem with whitespace or dom characters before <? in file.

Edit file where error is showing with Hex Editor XVI32 (easy to find on the web). In right window, first two signs must be <?

If is empty space or strange characters, just delete it. Should help
+4 votes
I was working on custom theme and this weird issue I faced many time. Initially couldn't understand what was wrong. I was trying to find if anything there before <?php white space bla bla. Just got literally frustrated as nothing was there in the file which I could say which was creating this issue. Even had tried to get help but no one came up with some solving answer.

After sometime was working on different aspects for qa-themes and I found the reason causing this error on the Admin section only.

The reason was character encoding with UTF-8

I know many people won't believe but this is true. As I changed encoding from UTF-8 to UTF-8 witout BOM that error just gone. I have also tried with ANSI and worked just fine. To confirm that UTF-8 is the reason I had changed back to UTF-8 and error again appeared.

However I still don't understand why UTF-8 creates an error and I am still required some solid explanation. Hope Gideon or someone will help to understand this.

By the way. if someone don't know how to change character encoding than I would prefert to open your file in Notepad++ and first check either your file using UTF-8 character set from the Encoding menu.

So if you want to change than you should use convert to UTF-8 without BOM or conver to ANSi or something from Encoding menu.

This is the only reason I found for this error where rest of the things are fine in theme file.

Hope this will help to other memebers.
I struggled with this as well when writing a plugin: http://www.question2answer.org/qa/16159/

Here is a great tutorial about encoding, that helped me:

Somebody else faced this "encoding" problem here in Dec 2011: http://www.question2answer.org/qa/11373/
0 votes

I found the issue, it's quite stupid.

In qa-theme-base.php
I modified by accident  |     <?php           where " | "is the beging of line
I modified it back |<?php    at the begining of line with no space and it works..

Sometime we believe that issue is stupid but it is not in reality. Read this http://php.net/manual/en/function.header.php Also read what Kai shared. That is extremely great share.