如何配置PHP显示详细的错误而不是错误500页? [英] How to configure PHP to display detailed errors instead of error 500 page?

查看:130
本文介绍了如何配置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文件见
见http://learn.iis.net/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 http://learn.iis.net/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页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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