How to configure PHP to display detailed errors instead of error 500 page?

痞子三分冷 提交于 2019-12-10 22:13:21

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/3271790/how-to-configure-php-to-display-detailed-errors-instead-of-error-500-page

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!