Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7797545
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T23:43:06+00:00 2026-06-01T23:43:06+00:00

I’m trying to run a simple PHP script on MAMP. I’m using PHP 5.2.17

  • 0

I’m trying to run a simple PHP script on MAMP. I’m using PHP 5.2.17 and I have compression turned off. Im trying to execute this simple script

<?php
    ob_flush();
    foreach(range(1,9) as $n){
    echo $n."\n";
    flush();
    sleep(1);
}

For sme reason this is not doing what it is supposed to. Rather than sequentially echoing out the numbers, it’s simply echoing them out when the loop is done. Am I missing something? is there another way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T23:43:08+00:00Added an answer on June 1, 2026 at 11:43 pm

    Output buffering is a mechanism for controlling how much output data
    (excluding headers and cookies) PHP should keep internally before
    pushing that data to the client. If your application’s output exceeds
    this setting, PHP will send that data in chunks of roughly the size
    you specify. Turning on this setting and managing its maximum buffer
    size can yield some interesting side-effects depending on your
    application and web server. You may be able to send headers and
    cookies after you’ve already sent output through print or echo. You
    also may see performance benefits if your server is emitting less
    packets due to buffered output versus PHP streaming the output as it
    gets it. On production servers, 4096 bytes is a good setting for
    performance reasons.

    Note: Output buffering can also be controlled via Output Buffering Control
    functions.

    php.ini Possible Values:

    On = Enabled and buffer is unlimited. (Use with caution) 
    Off = Disabled    
    Integer = Enables the buffer and sets its maximum size in bytes.  
    eg: output_buffering = Off
    

    Note: This directive is hardcoded to Off for the CLI SAPI

    http://php.net/output-buffering

    A Working example if output_buffering is set to 4096

    <?php
    ob_start();
    // Output string to overflow browser php.ini output_buffering setting.
    echo str_repeat(PHP_EOL, 4097);
    
    for ($i=0; $i<5; $i++) {
      echo PHP_EOL.$i;
      ob_flush();
      flush();
      sleep(1);
    }
    ob_end_flush();
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I have just tried to save a simple *.rtf file with some websites and
I have this code to decode numeric html entities to the UTF8 equivalent character.
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
I'm trying to create an if statement in PHP that prevents a single post
I have thousands of HTML files to process using Groovy/Java and I need to
I am trying to loop through a bunch of documents I have to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.