Error 330 (net::ERR_CONTENT_DECODING_FAILED):
Asked Answered
P

17

111

Recently we migrated to a new server. After 2 days, I got the following issues

1) We had a crash on a session table, which we easily fixed by reparing it

2) We run OpenX as our adserver, and it also crashed, but there is no evidence in error.log It let's you login, but at the moment of looking to dashboard.php, we get the:

Error 330 (net::ERR_CONTENT_DECODING_FAILED): (Google Chrome)

and

The page you are trying to view cannot be shown because it uses an invalid or unsupported form of compression. (Firefox)


OpenX uses the following services on PHP:

OpenX requires: http://www.openx.com/docs/2.8/adminguide/System%20requirements

OpenX uses the default PHP settings. However, server administrators sometimes change these settings. Before you install OpenX check that the following settings are correct:

magic_quotes_runtime must be off safe_mode must be off register_argc_argv must be on if you want to run maintenance via command line file_uploads need to be turned on to allow HTTP file uploads OpenX requires the following PHP extensions:

Either the mysql extension, or the pgsql. The mysqli extension is not supported. The ZLib extension, to convert links inside compressed Flash files generated by Flash MX. The FTP extension. If this is not present OpenX will try to simulate it, which can be a less stable solution.

The GD extension, to generate graphs on the Home page. If the extension is not enabled you will not be able to view graphs or statistics on your Home page. Either the openssl extension or an SSL-enabled curl extension are required in order to logon to the Home page. If SSL is not enabled you will receive an error message in the Home page, but there is no impact on operations.


Any clue on possible reasons or on how to gather more information will be much appreciated. Thanks

Persuasive answered 26/12, 2012 at 11:14 Comment(0)
R
147

It happens when your HTTP request's headers claim that the content is gzip encoded, but it isn't. Turn off gzip encoding setting or make sure the content is in fact encoded.

Rakehell answered 26/12, 2012 at 12:2 Comment(3)
This fixed my issue thankyou. I'm just curious if anyone knows if this is the error you would get if the browser your using does not support gzip compression?Cannonball
I came across this issue when php was outputting a plain text warning above the gzipped content.Jejune
I had this problem when plain text file was stuck in apache cache, but browsers were expecting gzipped contentIntoxicate
V
59

I enabled zlib.output_compression in php.ini and it seemed to fix the issue for me.

Vinavinaceous answered 26/2, 2015 at 14:33 Comment(1)
Worked for me too. (quercus-4.0.39 + glassfish4 + create web-inf/php.ini manually.Hettie
B
22

codes need to save UTF8 without BOM while recording. Sometimes, written codes with (Notepad++) or other coding tools and use UTF8 encode, this error occurs. I'm sorry, I do not know English. This is just my experience.

Burgonet answered 2/10, 2013 at 23:4 Comment(1)
+1 This was my problem also. Had to do a hard reboot because I didn't hit shift-escape fast enough :(. Still don't know why the file wasn't utf-8 encoded (sublime text 3 build 3083). Checked defaults and it was utf-8. Maybe I accidentally hit a ctrl-s-something to save in some other format...Savoirvivre
R
9

This error caused because of output buffering modules extension(ob_gzhandler) added. While output buffering use at starting ob_start() and ending ob_flush()

<?php   
    ob_start( 'ob_gzhandler' ); 
    echo json_encode($array);
    ob_end_flush();
?>

Use this:

<?php   
    ob_start(); 
    echo json_encode($array);
    ob_flush();
?>
Recline answered 5/1, 2015 at 14:15 Comment(1)
It works together with enabling zlib.output_compression in php.ini. By the way - [PHP.net] (php.net/manual/en/function.ob-gzhandler.php) notes that using zlib.output_compression is preferred over ob_gzhandler().Counterattack
I
8

If you are to use the Codeigniter framework then just make this into config file:

$config['compress_output'] = FALSE;

And in php.ini configuration file, use:

zlib.output_compression=On
Ianiana answered 23/12, 2016 at 7:37 Comment(1)
Actually changing the php.ini directive value does the fix, as doing so will enforce all the output to be gzipped. The Codeigniter config will set the header and it is up to the web application server to enforce that in the output. I tried to set $config['compress_output'] = TRUE while keeping the zlib.output_compression=On. It has the same effect. +1 for the direction.Longobard
Y
2

Do you use the ob_start(ob_gzhandler) function? If so and If you output any content above the ob_start(ob_gzhandler) function, you'll get this error. You can don't use this function or don't output content above this function. The ob_gzhandler callback function will determine what type of content encoding the browser will accept and will return its output accordingly. So if you output content above this function, the content's encoding maybe different from the output content of ob_gzhandler and that cause this error.

Yepez answered 19/6, 2015 at 2:23 Comment(0)
S
2

In case anyone still hunting the cause of this hateful issue, there comes a solution to nail the causing file. https://www.drupal.org/node/1622904#comment-10768958 from Drupal community.

And I quote:

Edit

includes/bootstrap.inc:

function drupal_load(). It is a short function. Find following line: include_once DRUPAL_ROOT . '/' . $filename; Temporarily replace it by

ob_start();
include_once DRUPAL_ROOT . '/' . $filename;
$value = ob_get_contents();
ob_end_clean();
if ($value !== '') {
  $filename = check_plain($filename);
  $value = check_plain($value);
  print "File '$filename' produced unforgivable content: '$value'.";
  exit;
}
Sculpsit answered 9/11, 2016 at 13:30 Comment(1)
Thanks for this. This helped me track my problem down, I had a custom drupal module that had no code in it. Adding <?php fixed it.Massimiliano
S
2

One more idea for anyone else getting this...

I had some gzipped svg, but it had a php error in the output, which caused this error message. (Because there was text in the middle of gzip binary.) Fixing the php error solved it.

Superstar answered 21/1, 2017 at 15:54 Comment(1)
Agreed, check all your PHP error logs before turning compression on. Especially if you didn't recently turn off zlib compression, and are now getting the error. Just fixed a bad DB query that was causing this same error. Enabling zlib.output_compression just gave me a browser full of garbage characters.Followthrough
S
2

Enable gzip compression in php.ini:

zlib.output_compression = On

And add this to your .htaccess file:

<IfModule mod_deflate.c>
  # Compress HTML, CSS, JavaScript, Text, XML and fonts
  AddOutputFilterByType DEFLATE application/javascript
  AddOutputFilterByType DEFLATE application/rss+xml
  AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
  AddOutputFilterByType DEFLATE application/x-font
  AddOutputFilterByType DEFLATE application/x-font-opentype
  AddOutputFilterByType DEFLATE application/x-font-otf
  AddOutputFilterByType DEFLATE application/x-font-truetype
  AddOutputFilterByType DEFLATE application/x-font-ttf
  AddOutputFilterByType DEFLATE application/x-javascript
  AddOutputFilterByType DEFLATE application/xhtml+xml
  AddOutputFilterByType DEFLATE application/xml
  AddOutputFilterByType DEFLATE font/opentype
  AddOutputFilterByType DEFLATE font/otf
  AddOutputFilterByType DEFLATE font/ttf
  AddOutputFilterByType DEFLATE image/svg+xml
  AddOutputFilterByType DEFLATE image/x-icon
  AddOutputFilterByType DEFLATE text/css
  AddOutputFilterByType DEFLATE text/html
  AddOutputFilterByType DEFLATE text/javascript
  AddOutputFilterByType DEFLATE text/plain
  AddOutputFilterByType DEFLATE text/xml

  # Remove browser bugs (only needed for really old browsers)
  BrowserMatch ^Mozilla/4 gzip-only-text/html
  BrowserMatch ^Mozilla/4\.0[678] no-gzip
  BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
  Header append Vary User-Agent
</IfModule>
Suppositive answered 10/2, 2017 at 19:23 Comment(0)
S
1

I was experiencing this issue on a site and none of the other solutions in this thread helped. After some troubleshooting I found the local.settings.php had a closing tag with a space after it like so:

<?php
$databases = array(
  'default' =>
  array (
    'default' =>
    array (
      'driver' => 'mysql',
      'database' => 'xxx',
      'username' => 'xxx',
      'password' => 'xxx',
      'port' => '',
      'host' => 'xxx',
    ),
  ),
);
?>
 

Updating local.settings.php to the following resolved:

<?php
$databases = array(
  'default' =>
  array (
    'default' =>
    array (
      'driver' => 'mysql',
      'database' => 'xxx',
      'username' => 'xxx',
      'password' => 'xxx',
      'port' => '',
      'host' => 'xxx',
    ),
  ),
);

The closing "?>" PHP tag is not necessary here. If you choose to use a closing tag you must ensure there are no characters / whitespace after it.

Selfimmolating answered 7/7, 2017 at 14:51 Comment(0)
S
1

I had a bit of a dummy moment this morning when I realized what caused this issue for me.

The strange thing is that the request was failing in both Firefox and Chrome, but worked when I tried to access via Fiddler Web Debugger.

For me, the problem was I had mis-typed a character into one of the PHP files in the project. I didn't notice this until I checked Git for changes to the project.

In my case I had: m<?php runMyProgram(); ?>.

Once I erased the m, it started working again.

Saiga answered 23/7, 2018 at 11:49 Comment(1)
a blank space before open php tag can cause the same error.Macro
N
1

In my case it happened when adding a new application to IIS that needed to be proxied with Apache.

I needed to set ProxyHTMLEnable On to ProxyHTMLEnable Off to get the content. (It looks like some js code most have triggered the error, but this gave me at least something to work from.)

IIS is sending the page content Content-Encoding: gzip

<Proxy "http://192.168.1.1:81">
    ProxyHTMLEnable On   #> change this to Off
    ProxyHTMLURLMap  ...  ...
</Proxy>
Numerable answered 3/6, 2019 at 19:13 Comment(1)
I've the same problem, the solution was. unset the accept header to prevent the "proxied" server to sent gzipped data. ``` <Location /your_local_path/> RequestHeader unset Accept-Encoding </Location> ```Coral
V
0

We also had this problem when upgrading our system to Revive. After turning of GZIP we found the problem still persisted. Upon further investigation we found the file permissions where not correct after the upgrade. A simple recursive chmod did the trick.

Verdie answered 19/6, 2014 at 21:50 Comment(0)
R
0

There is a bad Java bug that will cause this: https://bugs.java.com/view_bug.do?bug_id=JDK-8189789

Retired answered 15/10, 2018 at 17:22 Comment(0)
L
0

A far more common answer is that you have some error that is getting appended to whatever your compressing. The solution is to set display_errors = Off in your php.ini file (Check in your terminal if it's On by running php --info and look for "display_errors")

That should do it. And, how do you discover what errors you're actually? Check your PHP error logs whenever you hit that route/page.

Good luclk!

Lavelle answered 20/2, 2020 at 18:48 Comment(0)
S
0

I saw this error in combination with the PageSpeed module enabled. The PageSpeed module has a cache that can be gzip compressed. So apparently what can happen is that content gets double compressed.

In order to rewrite resources, PageSpeed must cache them server-side. Until 1.10.33.0, these resources had been stored uncompressed. To reduce disk usage, decrease server latency, support higher compression levels, and increase server throughput, the HTTPCache can automatically gzip compressable resources as they are stored in the cache. To configure cache compression, set HttpCacheCompressionLevel to values between -1 and 9, with 0 being off, -1 being gzip's default compression, and 9 being maximum compression. The default value is 9, maximum compression.

I solved it by adding this line to my PageSpeed config:

HttpCacheCompressionLevel 0

which disables the compression.

Simmons answered 27/8, 2020 at 19:38 Comment(0)
C
0

You should delete new line before <?php Check it

Commonly answered 21/6, 2023 at 18:22 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.