Page 1 of 1

ob_start()

Posted: Fri Jan 07, 2005 10:42 pm
by ol4pr0
I am having troubles with ob_start

using the following i dont have any troubles using firefox or IE on win2k

Code: Select all

ob_start("gzhandler"); // or ob_start("ob_gzhandler");
// bunch of code
ob_end_flush();
ob_end_clean() however does result in a page not loading ( firefox and IE )

However the ob_start("gzhandler") and or ob_gzhandler as in the code above doesnt seem to work with IE and XP ( firefox loads up fine ).
XP does except ( ob_start(); and ob_end_flush(); )

Wondering the following.
a: is it me, something wrong with that ?
b: did somebody experience the same problem?

Posted: Fri Jan 07, 2005 10:51 pm
by feyd
I don't remember if it's done automatically or not, but the headers need to be changed to tell the browser to expect gzip compressed data:

Code: Select all

Date: Sat, 08 Jan 2005 04:50:20 GMT
Server: Microsoft-IIS/5.0
X-Powered-By: PHP/4.3.10
Content-Encoding: gzip
Cache-Control: private, pre-check=0, post-check=0, max-age=0
Expires: Sat, 08 Jan 2005 04:50:20 GMT
Last-Modified: Sat, 08 Jan 2005 04:50:20 GMT
Keep-Alive: timeout=25, max=100
Connection: Keep-Alive
Transfer-Encoding: chunked
Content-Type: text/html
^ sent by devnetwork's server.

Posted: Sat Jan 08, 2005 3:26 am
by kondro
That is the correct behaviour for ob_end_clean().

ob_end_start() starts the buffering of the output of the page to memory.

ob_end_clean() will delete anything in the buffer and stop buffering.

ob_end_flush() will output anything in the buffer and stop buffering.

the ob_* functions can be nested.

Posted: Sat Jan 08, 2005 6:15 am
by Shendemiar
If you're just wanting to compress your pages, use .htaccess file.

add the following to you .htaccess

Code: Select all

php_flag zlib.output_compression on 
php_value zlib.output_compression_level 1

Posted: Sat Jan 08, 2005 12:49 pm
by teksys
Shendemiar wrote:If you're just wanting to compress your pages, use .htaccess file.

add the following to you .htaccess

Code: Select all

php_flag zlib.output_compression on 
php_value zlib.output_compression_level 1
Gah...Unknown function. Damn host :(

-teksys