PHP - htaccess - output_buffering
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/4642097/
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
PHP - htaccess - output_buffering
提问by
I have the following code in an htaccess file in my application root to turn output buffering on.
我在我的应用程序根目录的 htaccess 文件中有以下代码来打开输出缓冲。
php_value output_buffering On
php_value output_handler mb_output_handler
On some servers it causes a 500 internal error, on others it works fine. Does anyone know why it sometimes causes an error. Is there a different way to do this?
在某些服务器上它会导致 500 内部错误,在其他服务器上它工作正常。有谁知道为什么它有时会导致错误。有没有不同的方法来做到这一点?
Thank you!
谢谢!
采纳答案by Pekka
You can use this syntax only if PHP is running as an Apache module.
仅当 PHP 作为 Apache 模块运行时,您才可以使用此语法。
The 500 errors probably come up on servers where this is not the case.
500 错误可能出现在并非如此的服务器上。
For total certainty, look into the server's error.log
file for a detailed error message.
为了完全确定,请查看服务器的error.log
文件以获取详细的错误消息。
回答by German Rumm
Those directives work only if PHP is installed as a module. On other servers it will result in 500, since they will be invalid directives
这些指令仅在 PHP 作为模块安装时才起作用。在其他服务器上,它将导致 500,因为它们将是无效的指令
回答by Richard Tuin
Not sure, but i think the error is caused by the first line.
不确定,但我认为错误是由第一行引起的。
Use php_flag for On/Off True/False switches, like this:
将 php_flag 用于 On/Off True/False 开关,如下所示:
php_flag output_buffering On