SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict jkassemi's Avatar
    Join Date
    Jan 2005
    Location
    Albuquerque
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Output Buffering

    I've read a lot about output buffering now. Everything I can find on the web without becoming a member of yet another site, as a matter of fact .

    I'm running Apache 1.3, PHP 4.3, and I can't get the output buffering to work for the life of me. I'm trying to program a link checker, and I want to update the page with the progress as it comes. I set my php.ini output buffering size to 1 instead of the 4K that was there by default. I've tried loads of combinations, including increasing the size of my output string to the 4K limit and then trying to flush the buffer. Here's what I have now:

    PHP Code:
    echo $string;
    while(@
    ob_end_flush());
    flush();
    ob_flush(); 
    I want the string to be printed every time I call the above echo. I've tried placing the flush() and ob_flush() after the echo call and, well, just about everything. I can't find a setting for output buffering in my httpd.conf, and I've also tried Firefox, IE, and Opera: all with the same result.

    Anybody have any ideas?

    Thanks in advance,

    James

  2. #2
    One website at a time mmj's Avatar
    Join Date
    Feb 2001
    Location
    Melbourne Australia
    Posts
    6,282
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Are you using Apache/Linux using the php4asapi.dll interface? If so, then using just flush() should output the buffer.

    However, if you are using the Apache module mod_gzip to gzip encode the data, or you are using output buffering or gzip compression defined in php.ini, then you will need to turn this off for flush() to work.
    [mmj] My magic jigsaw
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    The Bit Depth Blog Twitter Contact me
    Neon Javascript Framework Jokes Android stuff

  3. #3
    SitePoint Addict jkassemi's Avatar
    Join Date
    Jan 2005
    Location
    Albuquerque
    Posts
    268
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow. So you're the big guy . Well, I'm actually running Apache on Windows. I'm using PHP as a module. Here's the declaration for it in my httpd.conf file:

    ScriptAlias /php/ "d:/php4/"
    AddType application/x-httpd-php .php
    Action application/x-httpd-php "/php/php.exe"

    I've got the option to switch directly to php5, but I want the code to be compatible with v4.x, so of course, I'm writing with it.

    Umm... It does work on my Linux box, but I'd like it to work on my laptop, which I'm having a horrible time installing Linux on. So gzip isn't on, I even checked the httpd.conf file to make sure

    I turned output buffering to 0, and I'm still not getting anything... Thanks for helping!

    James


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •