Skip to main content
Topic: Headers already sent (Read 150 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Headers already sent

I think when scheduled task is running like this (?scheduled=task;ts=1515043800) there is an error reported like this (Headers already sent in /var/www/clients/clientXXX/webXXX/web/index.php at line 33).

I believe this is due to MultiTenancy addon but I need a direction to check for this to fix it.

Thank you in advance.

Re: Headers already sent

Reply #1
Depends on the direction you need.
In general it just means that the header function was called before the one in index.php at line 33.
The reason... well, most of the cases an error that for some reason sends an header too early in the games.
Bugs creator.
Features destroyer.
Template killer.

Re: Headers already sent

Reply #2
I resolved it by running the fast cgi after dispatcher code, instead of before it.
Code: [Select]
if (isset($_GET['scheduled']))
{
$controller = new ScheduledTasks_Controller();
$controller->action_autotask();

// Don't make people wait on us if we can help it.
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
}
}

I am, however, not sure of its effects though I managed to stop the header error.

Will it hurts if default ElkArte is also running in the above changed sequence instead of default as below?
Code: [Select]
if (isset($_GET['scheduled']))
{
// Don't make people wait on us if we can help it.
if (function_exists('fastcgi_finish_request'))0
fastcgi_finish_request();

$controller = new ScheduledTasks_Controller();
$controller->action_autotask();
}

Re: Headers already sent

Reply #3
hmm...
There is no other errors?
Did you try running manually  the scheduled task?
As I said, usually the headers already sent is due to a previous error firing, so I think that finishing the request before is just a silencing the error, sort of adding a @.
Bugs creator.
Features destroyer.
Template killer.

Re: Headers already sent

Reply #4
Yes. I did try manually running the scheduled task but there is no error. I also waited until now, and still no error.

The addon does not modify ScheduledTasks.controller.php, so I am not sure which part of the modification (or even hook) triggers the header send when fastcgi_finish_request() is run first before the scheduled tasks.

I can only follow the error if it is there but they are just the same if I am using the default index.php. So I am clueless to figure out other solution.

Re: Headers already sent

Reply #5
Does the addon have any scheduled task at all?
When you go to admin > manintenance > scheduled tasks > task log do you see any with a red cross? (Actually a red question mark :P)
Bugs creator.
Features destroyer.
Template killer.

Re: Headers already sent

Reply #6
I don't think so or at least not that I remembered anything about it while browsing the code, but I will check it out today. Thanks for the tips.

Re: Headers already sent

Reply #7
BTW: 1.0 or 1.1?
Because on 1.0 I remember seeing such errors around but I think it was fixed in 1.1?
Bugs creator.
Features destroyer.
Template killer.

Re: Headers already sent

Reply #8
I am using 1.1 now with the addon as well. What were the errors in 1.0 and how was that fixed? May be that will help me in narrowing this down.

Re: Headers already sent

Reply #9
Heck if I remember...
Bugs creator.
Features destroyer.
Template killer.

Re: Headers already sent

Reply #10
No problem. At least for now. ;)

 

Re: Headers already sent

Reply #11
Check the error log file. Anything relevant?