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
4
votes
2 answers

PHP ob_start() question

Am I allowed to have two or more ob_start(); in my php files if so what is the proper way to end one ob_start(); and start another?
HELP
  • 14,237
  • 22
  • 66
  • 100
4
votes
1 answer

redirect but still continue to process exec()

This code example is supposed to redirect and continue processing a long operation, however it doesn't redirect until after the exec command is complete. I've tried multiple other ways of doing this and nothing works. Where am I going…
trump
  • 41
  • 2
4
votes
3 answers

How can I set an output buffer name in php?

I have been browsing the documentation for PHP's ob_get_status function and found the following: Return Values: If called without the full_status parameter or with full_status = FALSE a simple array with the following elements is returned: Array…
Kalko
  • 406
  • 3
  • 11
4
votes
6 answers

PHP: Output data before and after sleep()?

This is purely for learning more about output buffering and nothing more. What I wish to do is echo a string to the browser, sleep 10 seconds, and then echo something else. Normally the browser would wait the full 10 seconds and then post the whole…
John
  • 3,238
  • 4
  • 22
  • 25
4
votes
1 answer

PHP ob_get_length seems to return incorrect value

I have a function that should return JSON responses to the client and then carry on processing without locking up the client, this seems to work fine unless I add the Content-Length header (which I'd like to do to ensure the client is freed up). The…
Egg Vans
  • 944
  • 10
  • 21
4
votes
2 answers

Powershell: How to capture output from the host

I am using powershell to automate some tasks related to checking out/merging in TFS. When I call tf get * /recurse I get a bunch of data scrolling by about the files that are getting checked out. The last line generated by this command (assuming…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
4
votes
2 answers

PHP ob_start: callback a static method with $this

With PHP's ob_start($callback), you can pass a static method as a callback like this: class TemplateRenderer { function myCallback($bufferContents) { return 'Foobar instead of the buffer'; } } ob_start(array('TemplateRenderer',…
DMack
  • 871
  • 2
  • 9
  • 21
4
votes
1 answer

Flushing the buffer after rendering the head of a page in Zend Framework

Our application has a lot of CSS and JS in the head tag and in an effort to improve perceived page load speed, I wanted the page to start fetching the external content as soon as possible, even while waiting for the other content to be served up by…
The Unknown Dev
  • 3,039
  • 4
  • 27
  • 39
4
votes
1 answer

PHP Output Buffer Getting White Screen & No Errors On Method Return

I have been using PHP for a very long time and for some reason migrating to a new server has caused a White Screen of Death. Obviously it must be because of a version difference. I have been using the same output buffer pattern for…
GoreDefex
  • 1,461
  • 2
  • 17
  • 41
4
votes
1 answer

Why is ob_get_contents not working

I have this code: hi
user2486953
4
votes
1 answer

How output buffering blocks in PHP/Apache works?

Suppose I am echoing random data from PHP to browser. Total amount of random data is about XGb and echo is done in YKb chunks. ob_start() is not used. Will echo calls block after PHP and Apache buffers are full (client is not capable of consuming…
Vladislav Rastrusny
  • 29,378
  • 23
  • 95
  • 156
4
votes
1 answer

php ini_set() changes don't take with safe mode off

I wanted to turn output buffering off. Currently it shows no value for local and master. I run ini_set('output_buffering',4092); and no changes in phpinfo(). Safe mode is off. What's the next thing to check?
Jared Eitnier
  • 7,012
  • 12
  • 68
  • 123
4
votes
1 answer

Line-buffering of stdout fails on MINGW/MSYS Python 2.7.3

The problem is illustrated by this simple script: import time, os, sys sys.stdout = os.fdopen( sys.stdout.fileno(), 'w', 1 ) # line-buffer stdout print 'before sleep' time.sleep( 10 ) print 'after sleep' If line-buffering is successful, then there…
wchlm
  • 365
  • 1
  • 11
4
votes
5 answers

How to prepend something to the beginning of the PHP output buffer?

How do you append something to the beginning of the output buffer? For example, say you have the following code: ob_start(); echo '

Start of page.

'; echo '

Middle of page.

'; echo '

End of page

'; Before flushing the contents to…
ProgrammerGirl
  • 3,157
  • 7
  • 45
  • 82
4
votes
1 answer

Is it a good practice to convert all non ssl references to ssl in a php page by str_replacing the- content in output buffer?

I needed to replace all the non ssl references in the html output of php. Is it a good practice to do it by doing a str_replace of the contents in the output buffer and flushing it out? Actually there are lots of includes and requires in the php…
Hisham
  • 411
  • 3
  • 9