Possible bug when wrapping CGI/FastCGI generated pages

Con Tassios <[email protected]> Tue, 8 Jan 2008 11:03:03 +1100 (EST)
Newsgroups gmane.comp.apache.mod-layout
Message-ID <[email protected]>
Using mod_layout5 to add headers/footers to PHP pages works OK when PHP is run
as an Apache module, however when PHP is run as a FastCGI application the
headers and footers appear to be applied to the page multiple times, if the
size of the web page exceeds the CGI output cache buffer size.

I am using mod_fcgid, Apache 2.2 and the latest mod_layout from
http://hg.tangent.org/mod_layout-5.0.

CGI version of PHP is called via an Apache 'Action' directive.

In httpd.conf I have the following:

<Location /fcgi/>
        SetHandler fcgid-script
        AddOutputFilterByType INCLUDES;LAYOUT text/html

        LayoutFooter "<P> FOOTER<P>"
        LayoutHeader "<P> HEADER<P>"

</Location>

AddType application/x-httpd-php .php
Action  application/x-httpd-php /fcgi/php5


The default size of the FastCGI OutputBufferSize is 64KB.  If PHP generates a
web page greater than 64KB multiple headers/footers appear within the contents
of the page.  Increasing OutputBufferSize to a larger amount than the size
of the page prevents this problem from occurring.