PHP 8.4.1 Released!

Buffer Size

Buffer sizes are expressed by integers and represent the number of bytes the buffer can store without flushing. When the size of output in the buffer exceeds the size of the buffer, the contents of the buffer are sent to the output handler, its return value is flushed and the buffer is cleared.

With the exception of "URL-Rewriter", the size of output buffers can be set when the buffer is started. If set to 0, the output buffer is only limited by the memory available to PHP. If set to 1, the buffer is flushed after every block of code producing any non-zero length output.

The size of output buffers can be retrieved by calling ob_get_status().

Output buffers started with ob_start() will have their buffer sizes set to the integer value passed to the function's second chunk_size parameter. If omitted, it is set to 0.

The output buffer started with output_buffering set to "On" will have its buffer size set to 0. If set to an integer than buffer size will correspond to that number.

"URL-Rewriter"'s buffer size is set to 0, therefore it is only limited by the memory available to PHP.

The size of zlib's output buffer is controlled by the zlib.output_compression php.ini setting. If set to "On" the buffer size will be "16K"/16384. If set to an integer then buffer size will correspond to that number in bytes.

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top