Turn output buffering off with htaccess

How would I turn output buffering off with htaccess?

I’ve got virtual hosting account, dont think they will change php.ini for me :slight_smile:

I’m not exactly sure how to do it with a .htaccess file but I think you can do it by having a little piece of code at the top of your script where you use the function ini_set(). An example:

<?php

// turn of output buffering
ini_set('output_buffering', 0);

?>

Note: Not all hosts allow you to use ini_set() but you can at least try it.

That didnt work :frowning: . I’m sure there is a way of doing it in htaccess. I could add ob_start(); to my pages I guess.

If you put ob_start() in the top of you script, output buffering will be on. You said in your first post that you want to turn it off…? :xeye:

sorry! I meant on :o

Oh, then I understand. Well, try using ini_set() again ( the code below ) and if that doesn’t work, use ob_start() and ob_end_flush().

<?php

// turn on output buffering
ini_set('output_buffering', 1);

?> 

Sorry for posting the wrong info first time around!!

That did the trick!! Thanks. :smiley:

via .htaccess:

php_flag output_buffering on
or
php_value output_buffering 1

Oh, I learnt something from this thread too… :slight_smile: