+ Reply to Thread
Results 1 to 8 of 8

Thread: PHP: flush()?

  1. #1
    cooliojazz is offline x10Hosting Member cooliojazz is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    27

    PHP: flush()?

    Is there some setting that needs to be changed for flush to work here? I can't seem to get it to work, though I've seen hints that certain php settings might need to be changed... I'm just doing
    PHP Code:
          echo "Some text";
          
    ob_flush();
          
    flush(); 
    which does nothing. Help would be appreciated, because if I can't use flush, I guess I'll have to think of some other way. It's just I came to the conclusion this would be optimal earlier today and would love to use it if possible. Thanks! =)

  2. #2
    leafypiggy's Avatar
    leafypiggy is offline Community Advocate leafypiggy is on a distinguished road
    Join Date
    Aug 2007
    Location
    Massachusetts
    Posts
    2,228

    Re: PHP: flush()?

    try:

    PHP Code:
    <?php
    error_reporting
    (E_ALL);
    echo 
    "Some text";
    ob_flush();
    flush();
    Neil Hanlon | x10Hosting Support Representative
    Neil[at]x10hosting.com
    █ I'm always happy to help. Just ask a question in Free Hosting
    Terms of Service IRC

  3. #3
    cooliojazz is offline x10Hosting Member cooliojazz is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    27

    Re: PHP: flush()?

    No errors are reported, it just won't show up. And I've tried this in two different browsers and both direct and through an xmlhttp request, all with the same result =\

  4. #4
    descalzo's Avatar
    descalzo is offline Grim Squeaker descalzo has a brilliant futuredescalzo has a brilliant futuredescalzo has a brilliant future
    Join Date
    Jul 2009
    Location
    Ankh-Morpork
    Posts
    7,636

    Re: PHP: flush()?

    PHP Code:
    <?php




    $stuff 
    = <<<END
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en-US">
    <head profile="http://gmpg.org/xfn/11">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Flush test </title>
    </head>
    <body>
    HI. <br/>                                                                                                                                               
    END;

    $stuff  =  $stuff date('h:i:s') . "<br />";

    $stuff str_pad$stuff 3900 ) ;

    echo 
    $stuff ;

    flush() ;

    sleep) ;

    echo 
    date('h:i:s') . "<br />\n";

    echo  <<<END
    </body>
    </html>

    END;
    ?>
    Seems like the output has to be a certain size before flush() will work on this setup.

    Trial and error got padding the output to 3900 works.
    Nothing is always absolutely so.

  5. #5
    cooliojazz is offline x10Hosting Member cooliojazz is an unknown quantity at this point
    Join Date
    Jan 2009
    Posts
    27

    Re: PHP: flush()?

    Thank you very much! Exactly what I needed! =D Odd number to be required though... =P

  6. #6
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP: flush()?

    The apparent failure of flush could be a result of buffering on the load balancing proxy.

  7. #7
    rafiq009 is offline x10Hosting Member rafiq009 is an unknown quantity at this point
    Join Date
    Dec 2007
    Posts
    16
    [QUOTE=descalzo;790142][PHP]



    Flush test


    HI.

    END;

    $stuff = $stuff . date('h:i:s') . "
    ";

    $stuff = str_pad( $stuff , 3900 ) ;

    echo $stuff ;

    flush() ;

    sleep( 5 ) ;

    echo date('h:i:s') . "
    \n";

    echo

  8. #8
    misson is offline x10 Spammer misson is a jewel in the rough
    Join Date
    Mar 2008
    Location
    Libertatia
    Posts
    2,506

    Re: PHP: flush()?

    @rafiq009: if you're not adding anything to the discussion, don't post. I'd say read the post on over-helping, but you're not even doing that.
    Be sure to read all pages linked in this post; they have further information that should prove useful. When asking for help, make sure you follow Eric Raymond's and Jon Skeet's guidelines for prompt, accurate responses. Please answer any questions I ask; they're not rhetorical (probably). Any posted code is intended as illustrative example, rather than a solution to your problem to be copied without alteration. Study it to learn how to write your own solution.
    Misson, not Mission.

+ Reply to Thread

Similar Threads

  1. Does anyone know how to Flush our DNS?
    By greenmonkey in forum Free Hosting
    Replies: 3
    Last Post: 06-10-2010, 04:21 PM
  2. How to flush DNS
    By Nikolasr in forum Free Hosting
    Replies: 3
    Last Post: 10-29-2007, 11:54 AM
  3. HOW DO I: Flush My DNS
    By Zenax in forum Computers & Technology
    Replies: 9
    Last Post: 10-29-2007, 09:58 AM
  4. How do i Flush my COX IP?
    By N2PGames in forum Computers & Technology
    Replies: 3
    Last Post: 02-11-2007, 08:28 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
x10hosting free hosting for the masses
dedicated servers