Output buffering

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
methos
Forum Newbie
Posts: 13
Joined: Sat Oct 21, 2006 8:31 am

Output buffering

Post by methos »

According to
the following code is used to "double buffer" when you need to "get content length" and "compress the html" at the same time.

Is "double buffering" needed to accomplish both things or do modern versions of PHP already take this "problem" into account?

Where do I put other headers ? such as:

Code: Select all

header ('Accept-Ranges: bytes');
header('Content-language: en');

Code: Select all

ob_start();
ob_start('ob_gzhandler');

  ... output the page content...

ob_end_flush();  // The ob_gzhandler one

header('Content-Length: '.ob_get_length());

ob_end_flush();  // The main one
What would happen if I did this?

Code: Select all

ob_start();
ob_start('ob_gzhandler');
header ('Accept-Ranges: bytes');
header('Content-language: en');

  ... output the page content...

ob_end_flush();  // The ob_gzhandler one

header('Content-Length: '.ob_get_length());

ob_end_flush();  // The main one
Last edited by methos on Sun Feb 25, 2007 3:16 pm, edited 1 time in total.
choppsta
Forum Contributor
Posts: 114
Joined: Thu Jul 03, 2003 11:11 am

Post by choppsta »

I would suggest getting the LiveHTTPHeaders extension for Firefox. This will let you see all the response headers you get back from your server.
http://livehttpheaders.mozdev.org/
Post Reply