Re: How to disable output buffer per script
| From: | Curt Zirzow | Date: | Tue, 08 Jun 2004 18:43:12 +0000 |
| Subject: | Re: How to disable output buffer per script | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-187904@lists.php.net to get a copy of this message | ||
* Thus wrote Michael Sims (michaels@crye-leike.com):
> Curt Zirzow wrote:
> >
> > Use this at the top of the script:
> > ini_set('output_buffer', 0);
>
> The "output_buffering" setting cannot be controlled via ini_set(), at least
> according to the manual. I want to say that I confirmed this a long time ago but I
> can't recall for sure.
You're right.
>
> > Or, as I usually set up for my cli environment (since they ususally
> > desire no buffering), create a php-cli.ini file that has
> > output_buffering turned off.
>
> That's a good idea. But to do it on a per script basis (where it's undesirable to
> alter the global buffering setting) I think the only way is to call ob_end_flush()
> at the top of the script...
Another alternative is to change settings with shbang:
#!/usr/local/bin/php -d output_buffering=0
<?php
// continue on with no output_buffering.
Of course this will only work when the script is set executable and
is ran like a any other program, instead of 'php script.php`
Curt
--
First, let me assure you that this is not one of those shady pyramid schemes
you've been hearing about. No, sir. Our model is the trapezoid!