如何配置PHP显示详细的错误而不是错误500页?

编程入门 行业动态 更新时间:2024-10-28 18:31:42
本文介绍了如何配置PHP显示详细的错误而不是错误500页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我有一个PHP应用程序部署在我的IIS托管,我总是得到通用IIS错误500页面,而不是详细的错误页面。

我明白我需要修改一些php.ini文件(从这个问题)。

似乎display_errors设置正确:

echo ini_get '的display_errors');

输出 1 。

我还尝试在导致错误的函数中设置display_errors和error_reporting(我知道特定的功能是问题,因为我手动修改它)。

function sendEmail($ aForm,$ sFile ='messages.tpl',$ sTargetEmail = null){ error_reporting(E_ALL); ini_set('display_errors','On'); //其余的功能

编辑:我知道我应该将这些值设置为一些php.ini文件 - 当我只能通过FTP访问我的应用程序文件夹时,如何在共享主机上指定php.ini值?

如何识别错误详细信息?

解决方案

看起来像我这样打开'display_errors',但您的托管服务提供商正在重定向您的500错误页面到不显示错误的自定义页面。不是一个很好的设置,但我会联系您的托管服务提供商,希望他们能够解释这个问题。有可能在IIS上的.user.ini文件见 见learn.iis/page.aspx/745/enable-per-site-php-configuration-on- iis-60-and-iis-7-and-above / 再次只有您的托管服务提供商才知道是否设置了这个。

I have a PHP application deployed on my IIS hosting and I am always getting generic IIS "error 500" pages insteady of detailed error pages.

I understand I need to modify some php.ini file (from this question).

It seems that display_errors is set correctly:

echo ini_get('display_errors');

outputs 1.

I have also tried setting display_errors and error_reporting in the function that causes the error (I know the particular function is the problem because I manually modified it).

function sendEmail( $aForm, $sFile = 'messages.tpl', $sTargetEmail = null ){ error_reporting(E_ALL); ini_set('display_errors', 'On'); //rest of the function

EDIT: I know I should have set these values in some php.ini file - how can I specify php.ini values on a shared hosting, when I have only access to my app folder via FTP?

How can I identify the error details?

解决方案

It looks to me like you do have 'display_errors' turned on but your hosting provider is redirecting your 500 error page to a custom page which doesn't display the errors. Not a great set up but I would contact your hosting provider in the hope that they can shed some light on the problem. It is possible to have .user.ini files on IIS see see learn.iis/page.aspx/745/enable-per-site-php-configuration-on-iis-60-and-iis-7-and-above/ again only your hosting provider would know if this is set up.

更多推荐

如何配置PHP显示详细的错误而不是错误500页?

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

发布评论

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

>www.elefans.com

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