PHP:500 错误页面错误

编程入门 行业动态 更新时间:2024-10-24 12:29:10
本文介绍了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 错误页面错误

本文发布于:2023-10-31 15:39:01,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546528.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:错误   页面   PHP

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!