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

From my server's error log:

PHP Warning:  Cannot modify header information - headers already sent by (output started at /qa-include/qa-theme-base.php:106) in /qa-include/qa-app-cookies.php on line 61

I am having a couple of those error messages in my log. What could be causing it? Cookies?


Line 106 from qa-theme-base.php in function output_raw($html):
  echo str_repeat("\t", max(0, $this->indent)).$html."\n";

Line 61 from qa-app-cookies.php in function qa_cookie_get_create():
  setcookie('qa_id', $cookieid, time()+86400*365, '/', QA_COOKIE_DOMAIN);


Q2A version: 1.5.1

1 Answer

+1 vote

This should not be happening in the Q2A core. It is possible one of the plugins you have installed is calling qa_cookie_get_create() after the Q2A theme has started outputting content. So perhaps search your plugins for that call?

Thanks for your reply. I checked and found

1. badges plugin (v2.2):
qa-badge-check.php line 628
qa-plugin.php line 261

2. wysiwyg editor plugin
qa-wysiwyg-upload.php line 108

I have not changed anything there.
edited by
2 months without any problem. Now again I have the same php warning showing up... strange.

The wysiwyg-plugin checks if userid exists:
$cookieid=isset($userid) ? qa_cookie_get() : qa_cookie_get_create();

The badges plugin on the other hand, does not:
qa_remote_ip_address(), $user_id, $handle, qa_cookie_get_create(), 'badge_awarded', ...

Could this be causing problems?

Edit: Found in the error log another line, causing this issue:
headers already sent by (output started at /qa-include/qa-theme-base.php:79) in /qa-include/qa-app-cookies.php on line 61