Browser FAIL: "Unsupported form of compression" related to PHP notice

One of my sites had a funny error complaining about an "unsupported form of compression" shortly after installing a new module. The browser would return a white screen of death with an error message (Safari and Firefox).

Content Encoding Error
The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression.

Turning off the module would have stopped the issue, but I did some googling and noticed a post on about a similar content encoding error message for a different module. The problem ended up being related to the level of PHP error reporting on his server - that is, when an error occurs, PHP will send some text at the top of the page informing you of a problem with your code.

Turns out there was a bug in the code. I went digging through the issue queue for that particular module and noticed another user having the same problem, so I submitted a patch and applied the fix to my local code. With any luck, the next release of the module will contain the fix, and nobody will ever have the exact same error.

The problem ended up being caused by the page compression. Drupal uses page compression techniques to zip the outgoing HTML to make the file size smaller, which is supported by most browsers. The white screen happened when the PHP notice got added to the top of the page. Normally, a PHP fatal error would not send any data, just the error. In this case, the problem was just a notice-level error, so the HTML output was still sent, and somehow the notice text was not compressed.

In order to see the error, I used a command-line tool called wget. Then I used a text editor to inspect the top few lines of the incoming source. Most of it will be garbage, but if you're having the same PHP notice problem, you will see the notice right up at the top.

Here's the line I used for wget:
wget --header "Accept-Encoding: gzip,deflate" http://[site_url]


Thanks Ryan, picked up something similar having added some extra error reporting to a drupal install...

Appreciate the post, found after Googling...

Submitted by Guest (not verified) on Mon, 04/26/2010 - 12:23

Downloaded updates for Windows 7 today and getting that error everywhere, especially on Facebook.

Please zip it or post it where I can download it.

Tim St. John
The Roost, Myrtle Beach SC

[email protected]

Submitted by Guest (not verified) on Fri, 01/07/2011 - 20:33

Tim, I'm sorry, but I think this is something Facebook would have to fix. This patch only applies to anyone running a Drupal site.

Hi. I am cyrus munyao. I have had the same problem in contao. this blog has help me alot. however, i solved my problem by setting cache to false. Thanks and God bless you

Submitted by Guest (not verified) on Fri, 04/08/2011 - 02:43

in "about:config"
look for network.http.use-cache & set it to false

look for "network.http.accept-encoding" &
erase the string or set it to ;
gzip,deflate,compress;q=0.7 or gzip,deflate;q=0.9,compress;q=0.7

To restore both of the above right-click the setting and choose "reset".

Submitted by Guest (not verified) on Mon, 03/19/2012 - 23:55

I don't recommend this option (long term, please make sure you reset) because I'd like to see what my users will see. If you do change this in one browser make sure you have another that behaves the normal way.

Sign up to receive email notifications of whenever we publish a new blog post or quicktip!