PHP:500错误错误页面错误、页面、PHP

2023-09-02 09:51:24 作者:英语你回家吧不要客死异乡

作为prelude,我知道什么是HTTP 500是的,我知道如何解决这些问题。

As a prelude, I know what a HTTP 500 is, and I know how to fix them.

在PHP 5.3,我正在一个生产环境show_errors关闭。当有任何致命错误,用户得到一个纯白色的500页面响应。我想以防万一有创建一个500错误页面的任何任何错误;只是这样更人性化。

On PHP 5.3, i'm running a production environment with show_errors off. When there are any fatal errors, the user gets a plain white 500 page in response. I'm trying to create a 500 error page just in case there any any errors; just so it is more user friendly.

我曾经是能够做到

ErrorDocument 500 500.html

这似乎没有然而,要工作了, - 甚至以为我404

It doesn't seem to be working anymore, however - even thought my 404

ErrorDocument 404 404.html

工作正常。

好奇,想看看解决这方面 - 感谢您的时间。

Curious to see solutions regarding this - Thank you for your time.

推荐答案

致命错误并不在自身生产500错误,他们将返回200空白页通常是(如果没有输出已刷新到浏览器在点错误的)。加上这不会帮助你,无论如何,像Apache将不再参与时,PHP是有错误。

Fatal errors don't produce 500 errors in and of themselves, they would return 200 with blank page typically (if no output had been flushed to browser at the point of the error) . Plus this will not help you anyway, as Apache would be no longer involved when PHP is having the error.

也许你可以注册一个关断功能来发送500头(获得500结果),并显示你要显示的内容。

Maybe you could register a shutdown function to send 500 header (to get 500 result) and display the content you want to display.

 
精彩推荐
图片推荐