*** cgi_buffer for PHP REQUIREMENTS ------------ cgi_buffer.php is a PHP (http://www.php.net/) library, and has been tested with PHP 4.01, on Linux. There should be no great issues using it with Windows platforms, but the author has little experience using CGI on them, and CANNOT SUPPORT WINDOWS INSTALLATIONS. PHP 4.01 or greater is REQUIRED, as cgi_buffer makes extensive use of output buffering. Also, Zlib should be compiled into PHP for best results. INSTALLATION ------------ After untarring the distribution, copy cgi_buffer.php into a convenient place. It should be accessible to the PHP process (this depends on how you have installed PHP; see its documentation for more information. USE AS A LIBRARY ---------------- To use cgi_buffer with PHP, you need to do two things; enable output buffering, and integrate it into your scripts. First, PHP4 Output buffering is enabled with the output_buffering directive. This can be done in Apache configuration with: php_flag output_buffering on This may also be set in php.ini; see the PHP documentation for more information. prepend.php may also be used to turn on output buffering using the auto_prepend_file directive. In Apache configuration; php_value auto_append_file /path/to/prepend.php Second, cgi_buffer needs to be integated in the scripts you wish to use it with. The easiest way to do this is to simply import it; at the end of your script, insert: Make sure that this is the last content (PHP or HTML) in the script. You may need to specify the exact path to the library. You can also automatically append cgi_buffer with the auto_append_file directive. In Apache configuration, php_value auto_append_file /path/to/cgi_buffer.php You can fine-tune cgi_buffer's behaviour by setting flags before the library is called. For example, will turn off ETag generation in the library. See the source for a complete listing. NOTES ----- It's not possible for cgi_buffer to detect that a non-text/* content-type has been set, so if you're generating these, you'll have to set $compress_content to 0 yourself. See bug id#5040 and #5278. Thanks to Chuck Hagenbuch for the in-PHP gzip function and other help. QUESTIONS? ---------- If you have any problems, questions or comments, please check the Web page first, and then try mailing me: http://www.mnot.net/cgi_buffer/ mailto:mnot@pobox.com