阿帕奇秋季返回PHP时失败 [英] Apache Fall Back When PHP Fails
问题描述
我想知道是否有人知道的方法来配置Apache回落到返回一个静态的HTML页面,它应该(阿帕奇)能够确定,PHP已经死了?这将提供一个优雅的解决方案开发人员显示错误页面,而不是(最坏的情况),应已执行PHP页面的源代码code。
I was wondering if anybody knew of a method to configure apache to fall back to returning a static HTML page, should it (Apache) be able to determine that PHP has died? This would provide the developer with a elegant solution to displaying an error page and not (worst case scenario) the source code of the PHP page that should have been executed.
感谢。
推荐答案
在Apache的配置不正确处理PHP文件的PHP源$ C $ C时才会显示。也就是说,当一个适当的处理程序没有被定义。
The PHP source code is only displayed when apache is not configured correctly to handle php files. That is, when a proper handler has not been defined.
在错误的,什么是可以显示在php.ini中进行配置,主要的display_errors变量。应该在生产环境中设置为关闭,log_errors上。
On errors, what is shown can be configured on php.ini, mainly the display_errors variable. That should be set to off and log_errors to on on a production environment.
如果PHP确实死了,Apache会由ErrorDocument指令定义的页面返回相应的HTTP状态code(通常为500)。如果没有死,而是陷入了一个循环,有没有什么可以就我知道的事情。
If php actually dies, apache will return the appropriate HTTP status code (usually 500) with the page defined by the ErrorDocument directive. If it didn't die, but got stuck in a loop, there is not much you can do as far as I know.
您可以针对不同的错误codeS指定不同的页面。
You can specify a different page for different error codes.
这篇关于阿帕奇秋季返回PHP时失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!