php 错误 330(网络::ERR_CONTENT_DECODING_FAILED):
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/14039804/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Error 330 (net::ERR_CONTENT_DECODING_FAILED):
提问by user1929691
Recently we migrated to a new server. After 2 days, I got the following issues
最近我们迁移到新服务器。2天后,我遇到了以下问题
1) We had a crash on a session table, which we easily fixed by reparing it
1) 我们在会话表上发生了崩溃,我们可以通过修复它轻松修复它
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:
2)我们运行OpenX作为我们的adserver,它也崩溃了,但是error.log中没有证据让你登录,但是在查看dashboard.php的那一刻,我们得到:
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 在 PHP 上使用以下服务:
OpenX requires: http://www.openx.com/docs/2.8/adminguide/System%20requirements
OpenX 要求: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:
OpenX 使用默认的 PHP 设置。但是,服务器管理员有时会更改这些设置。在安装 OpenX 之前,请检查以下设置是否正确:
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:
magic_quotes_runtime 必须关闭 safe_mode 必须关闭 register_argc_argv 如果要通过命令行运行维护必须打开 file_uploads 需要打开以允许 HTTP 文件上传 OpenX 需要以下 PHP 扩展:
Either the mysqlextension, or the pgsql. The mysqliextension 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.
无论是mysql扩展名,还是pgsql. 在mysqli不支持扩展。ZLib 扩展,用于转换由Flash MX. FTP 扩展。如果这不存在,OpenX 将尝试模拟它,这可能是一个不太稳定的解决方案。
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.
GD 扩展,用于在主页上生成图表。如果未启用扩展程序,您将无法在主页上查看图表或统计信息。需要 openssl 扩展或启用 SSL 的 curl 扩展才能登录主页。如果未启用 SSL,您将在主页中收到错误消息,但不会影响操作。
Any clue on possible reasons or on how to gather more information will be much appreciated. Thanks
任何有关可能原因或如何收集更多信息的线索将不胜感激。谢谢
回答by THE ONLY ONE
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.
当您的 HTTP 请求的标头声称内容是 gzip 编码的,但事实并非如此时,就会发生这种情况。关闭 gzip 编码设置或确保内容实际上已编码。
回答by Francisco Cortes
I enabled zlib.output_compressionin php.iniand it seemed to fix the issue for me.
我启用zlib.output_compression了php.ini它似乎为我解决了这个问题。
回答by user259374
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.
编码需要在录制时保存没有 BOM 的 UTF8。有时,用(Notepad++)或其他编码工具编写的代码并使用UTF8编码时,会出现此错误。对不起,我不懂英文。这只是我的经验。
回答by sankar muniyappa
This error caused because of output buffering modules extension(ob_gzhandler) added. While output buffering use at starting ob_start() and ending ob_flush()
由于添加了输出缓冲模块扩展(ob_gzhandler)而导致的此错误。在开始 ob_start() 和结束 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();
?>
回答by Kaushik Dey
If you are to use the Codeigniterframework then just make this into config file:
如果您要使用该Codeigniter框架,则只需将其制作为配置文件:
$config['compress_output'] = FALSE;
And in php.iniconfiguration file, use:
在php.ini配置文件中,使用:
zlib.output_compression=On
回答by Redzarf
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.
我有一些 gzip 压缩的 svg,但它在输出中有一个 php 错误,这导致了这个错误消息。(因为 gzip 二进制文件中间有文本。)修复 php 错误解决了它。
回答by kurdtpage
Enable gzip compression in php.ini:
在php.ini 中启用 gzip 压缩:
zlib.output_compression = On
And add this to your .htaccessfile:
并将其添加到您的.htaccess文件中:
<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>
回答by linjie
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_gzhandlercallback 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_gzhandlerand that cause this error.
你会使用这个ob_start(ob_gzhandler)功能吗?如果是这样并且如果您在ob_start(ob_gzhandler)函数上方输出任何内容,您将收到此错误。您可以不使用此功能或不在此功能上方输出内容。该ob_gzhandler回调函数将确定什么类型的编码器将接受的内容,并相应地返回它的输出。因此,如果您在此函数上方输出内容,则内容的编码可能与 的输出内容不同ob_gzhandler,从而导致此错误。
回答by Hao
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-10768958from Drupalcommunity.
万一有人仍在寻找这个可恶问题的原因,有一个解决方案来确定导致文件。https://www.drupal.org/node/1622904#comment-10768958来自Drupal社区。
And I quote:
我引用:
Edit
编辑
includes/bootstrap.inc:
includes/bootstrap.inc:
function drupal_load(). It is a short function. Find following line:
include_once DRUPAL_ROOT . '/' . $filename;Temporarily replace it by
功能drupal_load()。这是一个简短的函数。找到以下行:
include_once DRUPAL_ROOT . '/' . $filename;暂时将其替换为
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;
}
回答by MeSo2
In my case it happened when adding a new application to IIS that needed to be proxied with Apache.
在我的情况下,它发生在向 IIS 添加需要使用 Apache 代理的新应用程序时。
I needed to set ProxyHTMLEnable Onto ProxyHTMLEnable Offto get the content. (It looks like some js code most have triggered the error, but this gave me at least something to work from.)
我需要设置ProxyHTMLEnable On以ProxyHTMLEnable Off获取内容。(看起来一些 js 代码最容易触发错误,但这至少给了我一些工作。)
IIS is sending the page content Content-Encoding: gzip
IIS 正在发送页面内容 Content-Encoding: gzip
<Proxy "http://192.168.1.1:81">
ProxyHTMLEnable On #> change this to Off
ProxyHTMLURLMap ... ...
</Proxy>

