【问题标题】:How to simulate a 500 http error on apache如何在 apache 上模拟 500 http 错误
【发布时间】:2019-09-27 02:16:17
【问题描述】:

我阅读了很多关于如何测试 ErrorDocument 500 指令的想法,但它们不起作用。如果我输入了错误的 php 代码,我仍然会得到一个包含我的 php 错误的页面。如果我创建了一个错误的 htaccess 文件,我会收到以下错误,而不是我的自定义错误:

[an error occurred while processing this directive] The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there was an error in a CGI script. [an error occurred while processing this directive]

我需要提出这个自定义错误页面,以确保即使大多数应用程序将管理它们自己的 500 个页面,它也能正常工作。 谢谢

【问题讨论】:

标签: apache custom-error-pages custom-errors


【解决方案1】:

PHP 错误不是 500 错误。阿帕奇很好。 PHP 遇到了错误。这可以隐藏在 PHP.ini 中,但它会导致“白屏死机”。

关于 .htaccess 问题。 .htaccess 文件控制您网站的自定义错误页面。如果 Apache 无法解析此文件中的自定义错误页面,则意味着没有设置要显示的自定义错误页面。

【讨论】:

  • 我将自定义错误放在 httpd.conf 文件中。 htaccess 只是为了强制服务器出错
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-04-14
  • 2011-07-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-02
  • 1970-01-01
相关资源
最近更新 更多