PHP Oddity

Discovered a little oddity with PHP and Firefox. In my root .htaccess file I have:

php_flag zlib.output_compression On
php_value zlib.output_compression_level 9

This causes all PHP files to be compressed, if the user agent accepts compression.

My error page is also a PHP script, mostly to trap the referring URL and include that in the page. Entirely by accident tonight I discovered that the error page was being returned as complete gibberish to Firefox. My guess is that Firefox was receiving the error page as a compressed page, but was not uncompressing it.

A little investigation with the Live HTTP Headers extension revealed that the page was being served with Transfer-encoding: chunked instead of Content-encoding: gzip. I don't know where to look to debug further, but did manage to override the behaviour on the server side by adding:

php_flag zlib.output_compression Off

to the .htaccess for the directory containing my error pages.

«Waiting for Time Warner Cable | Main | Wikiphilia»

Slightly acerbic and eccentric dog walker who masquerades as a web developer and occasional CTO.

Spent five years running the technology side of the circus known as www.ibm.com.

More about me here.

Archives

Get updates via email

Enter your email address:

Delivered by FeedBurner