Hey all,

I'm running Drupal 5.15, and I'm noticing this really strange issue. When I go into the admin interface, and click Log Out, I get this error message in FireFox:

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

If I clear the cache_page table, I can browse the site anonymously without issues, it's only when I've logged out of the front-end that I see this issue. In the Performance settings, I've chosen "Normal" caching and I'm *not* aggregating/gzipping CSS, however in the Content-Encoding of the HTTP Header I see "gzip". All browsers fail in the same way...



mbelos’s picture

If I disable the Caching in Drupal, all works fine. As soon as I enable the caching, I get this problem. Any ideas??

mbelos’s picture

Ok I figured out why this was happening. Looks like there was a PHP Notice in the page output, which was breaking the encoding of the page. Where you'd normally have this in a gzipped html page:

^_�^H^@^@^@^@^@^@^C�Ymo�8^R��^@�^_�\�pw��&�^Vmjk�礸⤸��&Eo��^Hh �۾ ^Wc`Q^\^?8^]Ǿ��վ9���W�^¾��!\ھJ�6�/^3`sk 8^.����@W���^F]

I was getting this:

<br />
<b>Notice</b>:  Undefined index:  q in <b> *******
^_�^H^@^@^@^@^@^@^C�Ymo�8^R��^@�^_�\�pw��&�^Vmjk�礸⤸��&Eo��^Hh �۾ ^Wc`Q^\^?8^]Ǿ��վ9���W�^¾��!\ھJ�6�/^3`sk 8^.����@W���^F]

So, to fix this you have three options.

(1) Disable Drupal caching (not recommended)
(2) Set display_errors = Off in your php.ini file
(3) Fix the PHP Notices (or get the contributors to)

In any case, I tested this by running the following command on my Linux box:
wget --header "Accept-Encoding: gzip,deflate" http://[site_url]

Then, open up the resulting index.html page, and have a look for any PHP Errors/Notices.

Hope this helps!!!


ghostwheel’s picture

just wanted to say thanks for posting the solution.

i inherited a drupal site with this error, and i was weltering in apache and .htaccess configurations until i found your post.

a tip of the cap to you, sir.

just as a addendum, i added the following line to the top of the drupal .htaccess file:

php_value display_errors Off

bkelly’s picture


Your post led me to the solution for my problem.

I had a few unprintable characters that had sneaked into the start of a few of my .module and .tpl files, (I believe thay were BOM). These leading characters made the compressed cache unreadable by the browsers. I did a search of my installation using this:

fgrep -rl `echo -ne '\xef\xbb\xbf'` .

Then using vi I could see and kill them.

Have Fun - Bill