Re: Re: Disadvantages of output buffering

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, August 28, 2007 6:40 pm, Felipe Alcacibar wrote:
> Emil Edeholt wrote:
>> Hi!
>>
>> My php project would get a much cleaner code if I could set cookies
>> anywhere in the code. So I thought of output buffering. But I can't
>> find
>> any articles on the cons of output buffering. I mean it most be a
>> reason
>> for it being off by default?
>>
>> Kind Regards Emil Edeholt
>
>
> The output buffering maybe would be unstable your php application  in
> some cases. May be it so slowly in some versions of php and depend of
> the web server that you have mounted your php. And it uses memory this
> point is so clearly.
>
> If you want to create cookies server/client "on the fly" you may need
> ajax, with this asynchronus requests you put headers and cookies
> instead, and use it on the fly in the browser if the http request is
> ok.
>
> Are you know the session variables, maybe you need that.
>
> Well, the desicion is yours. tell us what you want to do.

It's probably off by default for a couple reasons:

#1. It didn't used to exist, so to be backwards-compatible, it's off.

#2. It does chew up a lot of RAM for a large HTML file, which if you
don't need it, is Bad.

#3. Your page can seem to be "slow" if it's fairly large, and laid out
to not require the whole page to render the first portion of the page.
(No tables, and probably no CSS, just old-school simple HTML).

Note, however, that if you have a lot of little echo statements,
output buffering can actually improve overall performance, since it
doesn't dink around with sending a few bytes at a time and switching
back and forth from output to calculations.  Depends on your
application and a whole host of other variables.

-- 
Please vote for this great band:
http://acl.mp3.com/feature/soundandjury/?band=COMPANY-OF-THIEVES

Requires email confirmation.
One vote per day per email limit.
Obvious ballot-stuffing will be revoked.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux