Dreamhost Quirks

Dreamhost is doing some strange things with my php scripts.

  1. Why are you stealing my newlines?

    For some strange reason newlines at the end of files seem to be eaten. Take a look at these two php files.

    < ?php
    echo "This string has no newline at the end";
    ?>

    and

    < ?php
    echo "This first string has a newline at the end\n";
    ?>

    If you wget these two files (file1, file2) you will see that they are exactly the same. Who took my newline at the end of the second file?

  2. Why don’t you be polite and flush?

    This is a slightly more serious problem as it prevents Gregarius’ serverpush method for updating feeds from working on my dreamhost server. I took a very simple serverpush example from the XUL Planet Developer Guide and put it on my dreamhost server.

    < ?php
      header
    ('Content-type: multipart/x-mixed-replace;boundary="rn9012"');

      print "--rn9012\n";
      print 
    "Content-type: application/xml\n\n";
      print 
    "< ?xml version='1.0'?>\n";
      print 
    "First Part\n";
      print 
    "--rn9012\n";
      
    flush();

      sleep(5);
      print 
    "Content-type: application/xml\n\n";
      print 
    "< ?xml version='1.0'?>\n";
      print 
    "Second Part\n";
      print 
    "--rn9012--\n";

    ?>

    If you are using a Gecko browser and you point to this file on a dreamhost server, there will be a 5 second pause and you will only see the second part. Compare this with the same file on the xulplanet webserver, where you see the first part and then after a 5 second pause the second part.

If you have any ideas about what is going on, please let me know. You can find all these files (and their sources) here.

3 Responses to “Dreamhost Quirks”

  1. Philip Says:

    see ob_flush()

    btw, server push works with old non-gecko netscape browsers as well

  2. Sameer Says:

    I have already tried ob_flush() and flush() in a variety of permutations, but no luck. I even tried outputting lots of space, but no luck there either.

    I guess serverpush also works on opera, but I will be happy if I can get the latest version of firefox to work with dreamhost.

  3. n3ldan Says:

    Hey, did you ever figure out how to get flush(); working? I love dreamhost but not being able to use flush(); kinda sucks, alot.

Leave a Reply