PHP:500 错误页面错误 [英] PHP: 500 Error to error page

查看:25
本文介绍了PHP:500 错误页面错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

作为前奏,我知道什么是 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 个空白页(如果此时没有输出刷新到浏览器的错误).此外,这无论如何都无济于事,因为当 PHP 出现错误时,Apache 将不再参与.

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.

这篇关于PHP:500 错误页面错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆