Prev | Current Page 101 | Next

W. Jason Gilmore

"Beginning PHP and MySQL: From Novice to Professional"

PHP
version 4.0 offered a solution to this annoying problem by introducing the concept of
CHAPTER 2 ?–  CONFIGURING YOUR EN V IRONMENT 33
output buffering. When enabled, output buffering tells PHP to send all output at
once, after the script has been completed. This way, any subsequent changes to the
header can be made throughout the script because it hasn??™t yet been sent. Enabling
the output_buffering directive turns output buffering on. Alternatively, you can limit
the size of the output buffer (thereby implicitly enabling output buffering) by setting
it to the maximum number of bytes you??™d like this buffer to contain.
If you do not plan to use output buffering, you should disable this directive because it
will hinder performance slightly. Of course, the easiest solution to the header issue is
simply to pass the information before any other content whenever possible.
output_handler = string
Scope: PHP_INI_ALL; Default value: NULL
This interesting directive tells PHP to pass all output through a function before
returning it to the requesting user. For example, suppose you want to compress all
output before returning it to the browser, a feature supported by all mainstream
HTTP/1.1-compliant browsers. You can assign output_handler like so:
output_handler = "ob_gzhandler"
ob_gzhandler() is PHP??™s compression-handler function, located in PHP??™s output
control library.


Pages:
89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113