Jump to:

23490 Posts in 18996 Topics by 2878 members

General Questions

SilverStripe Forums » General Questions » SS3 on lighttpd - /dev/xxx returns blank screen

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

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

Page: 1 2
Go to End
Author Topic: 2872 Views
  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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.

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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...

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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.

  • Fuzz10
    Avatar
    Community Member
    787 Posts

    Re: SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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 ?

  • martimiz
    Avatar
    Forum Moderator
    1086 Posts

    Re: SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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);
       }
    }

  • theorytank
    Avatar
    Community Member
    8 Posts

    Re: SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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

  • richard-ward
    Avatar
    Community Member
    31 Posts

    Re: SS3 on lighttpd - /dev/xxx returns blank screen Link to this post

    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).

    2872 Views
Page: 1 2
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.