Questions tagged [output-buffering]

Use output-buffering for questions related to the use of one or more buffers in order to optimize performance by batching write operations

References

414 questions
9
votes
3 answers

PHP command line output buffer outputs regardless of buffer settings

I have some classes I am writing unit tests for which have echoes in them. I want to suppress this output and thought ob_start() and ob_clean() would suffice, but they aren't having an effect. public function testSomething (){ ob_start(); …
bcmcfc
  • 25,966
  • 29
  • 109
  • 181
9
votes
1 answer

What are the risks of increasing the "Maximum Output Buffer size"

I'm dealing with a migration from ColdFusion 9 to ColdFusion 11. One issue I've run into is essentially the same as that detailed in this question: cf10 unable to add text to HTML Head The root cause in my case is a particular page that weighs in at…
Fish Below the Ice
  • 1,273
  • 13
  • 23
9
votes
8 answers

In PHP, is there a way to capture the output of a PHP file into a variable without using output buffering?

In PHP, I want to read a file into a variable and process the PHP in the file at the same time without using output buffering. Is this possible? Essentially I want to be able to accomplish this without using ob_start():
Joe Lencioni
  • 10,231
  • 18
  • 55
  • 66
9
votes
3 answers

Flush output buffer in Apache/Nginx setup

I would like to have page content for a web page I am developing appear on screen as it is downloaded. In my test/development environment this works as expected using the PHP flush() command. However, my production setup (WPEngine) uses an Nginx…
rowatt
  • 421
  • 4
  • 16
8
votes
4 answers

PHP - How Detect if Output Buffering is Enabled

Is there a simple way to detect in PHP if output_buffering is enabled in php.ini? I'd like to be able to display a message if it is not enabled. Within my application I tried using an htaccess file to automatically enable it but it seems it does not…
usnidorg
  • 83
  • 1
  • 1
  • 3
8
votes
2 answers

Does die() do an ob_end_flush()?

I can't seem to find a good answer on this anywhere. If I am running output buffering, and a die() is fired, does that kick off an ob_end_flush() as well?
Ben Dauphinee
  • 4,061
  • 8
  • 40
  • 59
8
votes
2 answers

PHP Output Buffering

What are the methods to turn on output buffering either within a PHP script or using and htaccess file? I use the following method in an htaccess file in the root of my application: php_value output_buffering On php_value output_handler…
anon445699
8
votes
5 answers

How to fetch the data and display it in a browser simultaneously using PHP and Smarty?

I'm using PHP, MySQL, Smarty, jQuery, AJAX, etc. for my website. Currently, I'm fetching a large amount of data (matching question IDs) from the MySQL database, do processing on it, assigning this data to the Smarty template and printing it on a…
PHPLover
  • 1
  • 51
  • 158
  • 311
8
votes
2 answers

Does output buffering in PHP require more resources?

When performance is important including server memory,I am curious if using output buffering like ob_start(); in PHP has ANY performance hits over not using it? Does it use more memory or anything to use it? In my situation on a high traffic…
JasonDavis
  • 48,204
  • 100
  • 318
  • 537
7
votes
2 answers

What are the pros and cons of output buffering?

I have read on many websites that using ob_start(); can enhance your page load times, as it stores the php in a variable and displays it in one go rather than processing the php a bit of a time. Also it is extremely useful for header('location:…
Version1
  • 657
  • 5
  • 13
7
votes
1 answer

Does python logging.FileHandler use block buffering by default?

The logging handler classes have a flush() method. And looking at the code, logging.FileHandler does not pass a specific buffering mode when calling open(). Therefore when you write to a log file, it will be buffered using a default block size. Is…
sourcejedi
  • 3,051
  • 2
  • 24
  • 42
7
votes
4 answers

How to correctly show output at every echo on all browsers?

I moved my files to a new server and I had a script that instantly showed output on every echo to the browser, but this isn't working on the new server. Here is my test code: @ini_set('output_buffering', 0); @ini_set('implicit_flush', 1); for ($i =…
Abs
  • 56,052
  • 101
  • 275
  • 409
7
votes
1 answer

ob_get_level() starts at level 1

Having a few problems with output buffering. Mainly, I'm trying to run output buffering with the ob_gzhandler callback, but it keeps telling me its using an unsupported compression type. Everything is enabled, and I believe the problem is that…
Jason Lewis
  • 18,537
  • 4
  • 61
  • 64
7
votes
3 answers

PHP output buffering to text file

I am having trouble with an update script. It runs for a few hours so I would like it to output live to a text file. I start the document with ob_start(); Then within the while loop (as it iterates through the records of the database) I have…
Pablo
  • 4,273
  • 7
  • 33
  • 34
7
votes
2 answers

strange ob_start() behaviour - double output

ob_start() doesn't seem to be stopping any output so when I flush the buffer it's doubling up "; echo ob_get_flush(); ?> Outputs Text..... Text..... But I was expecting Text..... Any ideas ? Thanks
JimmyJ
  • 4,311
  • 3
  • 27
  • 25
1 2
3
27 28