Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

SS3 on lighttpd - /dev/xxx returns blank screen


Go to End


10 Posts   6570 Views

Avatar
martimiz

Forum Moderator, 1391 Posts

16 June 2012 at 1:32am

Edited: 16/06/2012 1:50am

Hi everyone

I'm having a problem with ss3 on lighttpd: the frontend and cms seem to work fine, but all urls starting with /dev/ return blank screens (no errors)

I'm using the default settings here http://doc.silverstripe.org/sapphire/en/trunk/installation/lighttpd, as they always worked on 2.4...

The weird thing is that the proper functions are called: DevelopmentAdmin->Index() on /dev/, TaskRunner->Index() on /dev/tasks/ For instance: if I add an exit(); to the end of the Taskrunner->index() function, all the tasks are now printed to the screen just fine. But after that something happens that results in a blank...

I do not have any problems with Apache. Of course it could be due to some other settings I have made in Lighttpd, but I really don't know where to look any more...

[EDIT - even trimmed lighttpd.conf to the bare minimum at the temp. expense of all other sites...]

Can anyone reproduce this?

Thanks, Martine

Avatar
Fuzz10

Community Member, 791 Posts

18 June 2012 at 10:46pm

Hmmm. Interesting, I have the same problem on a live server with Apache. Did not have time to thoroughly look, will let you know if I find a fix.

Avatar
martimiz

Forum Moderator, 1391 Posts

19 June 2012 at 1:12am

That's strange. Are you referring to 3.0 as well? So maybe it isn't a lighttpd thing at all. Anyone else have this?

It looks like some redirect happens after the tekst is displayed - for instance /dev/tasks/ should only display the list of tasks and do nothing else after that. But if I remove the exit() from the Taskrunner->index() function, obviously it does do something else (turn everything to white) :-(

And there are no errors... And firebug doesn't help...

Avatar
martimiz

Forum Moderator, 1391 Posts

19 June 2012 at 5:38am

Edited: 19/06/2012 5:41am

So far:
In my case the culprit was output buffering, preventing headers from being sent automatically with the generated output. So SilverStripe tries to create the headers 'manually' in SS_HTTPResponse->output(). Unfortunately the HTTPRespons body is always empty, so the Content-Length header is set to 0. That's the blank screen...

One way of getting the headers to be sent automatically seems to be flushing the output buffer.

In SS_HTTPResponse->output() around line 224:

} else {
	ob_flush();                   <-- ADD
	if(!headers_sent()) {
		header($_SERVER['SERVER_PROTOCOL'] . " $this->statusCode " . $this->getStatusDescription());
		foreach($this->headers as $header => $value) {
			header("$header: $value", true, $this->statusCode);
		}
	}
	...

This works but I've no idea yet about the impact on other code...

Another option would be to set output_buffering = off in php.ini

But obviously the respons body shouldn't be empty in the first place, and I don't quite know how that should be accomplished just yet, so this is not really a patch. I'll try and find a better solution to create one.

Avatar
Fuzz10

Community Member, 791 Posts

21 June 2012 at 9:46pm

Applied your fix to my production environment , did the trick as well.

And yes, I'm referring to SS3 on Apache. Ssssttrrraaaange, no ?

Should we raise a ticket about this ?

Avatar
martimiz

Forum Moderator, 1391 Posts

26 June 2012 at 2:30am

Edited: 26/06/2012 2:31am

So I created a ticket here - and then found out after I submitted it that the ob_flush() solution had issues after all :-(

I think this temporary(!) fix might work better, but it definitely isn't a patch and I wisely kept it from the ticket this time. It removes the Content-Length header if it is 0. Tested in ff, safari, chrome on mac:

HTTPResponse.php line 227 - replace:

foreach($this->headers as $header => $value) {
	header("$header: $value", true, $this->statusCode);
}

by
foreach($this->headers as $header => $value) {
	if ($header != 'Content-Length' || $value != '0') {
		header("$header: $value", true, $this->statusCode);
	}
}

Avatar
theorytank

Community Member, 8 Posts

6 July 2012 at 10:18am

Not a solution, but I found you can force the output by including the showqueries parameter however there's a lot of output to sort through after.

 /dev/build?flush=all&showqueries

For now I'm doing my /dev/build from the command line where it seems to work fine.

 framework/sake dev/build flush=all

Avatar
richard-ward

Community Member, 31 Posts

12 July 2012 at 1:28am

Just for extra info: I cannot get any output from dev/build either, but have found that adding the parameter debug=1 forces some output - and it may be less extra output than showqueries (which doesn't force output for me).

Go to Top