在IIS中显示PHP错误 [英] Display PHP Errors in IIS

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

问题描述

我正在尝试使用IIS vrs 8.5和PHP vrs 5.2.17在屏幕上显示PHP错误,但我继续获得IIS 500错误的http页面或空白屏幕。我已经发现了许多SO帖子已经有了修复,但是没有任何内容可以解决我的问题。这是我尝试过的。

I am trying to get PHP errors to display on the screen using IIS vrs 8.5 and PHP vrs 5.2.17, but I continue to get the IIS 500 error http page, or a blank screen. I have already found numerous SO posts that have supposed fixes, but nothing on them has fixed my problem yet. Here is what I have tried.


  • 将errorMode更改为Detailed。仍然得到500错误页面而不是php错误。

  • 删除了httpErrors块下默认IIS配置文件中的所有自定义错误。仍然获得IIS自定义500错误页面。

  • 在默认IIS配置中将existingResponse =PassThrough添加到我的httpErrors块。这样做会导致我得到一个空白页而不是php错误或IIS 500错误。

  • 我已经验证在站点默认system.config中没有覆盖这些设置。文件。

  • Changed errorMode to Detailed. Still getting the 500 error page instead of the php error.
  • Removed all of the custom errors in the default IIS config file under the "httpErrors" block. Still getting the IIS custom 500 error page.
  • Added existingResponse="PassThrough" to my httpErrors block in the default IIS config. Doing this causes me to get a blank page instead of the php error, or the IIS 500 error.
  • I have verified that none of these settings are being overwritten in the site default system.config files.

目前我在屏幕上显示空白页而不是IIS 500错误。我已经验证display_errors已打开,并且error_reporting是正确的。我也知道php页面运行得很好。我故意通过删除页面上的分号来导致此错误。所以我已经知道一切正常。 PHP错误日志记录也有效,但我希望错误显示在页面上,所以我不必每隔5分钟查看一次错误日志。

Currently I am getting a blank page instead of the IIS 500 error on the screen. I have already verified that display_errors is on, and error_reporting is correct. I also know that the php page runs just fine. I am purposely causing this php error by removing a semi-colon on the page. So I already know everything is working fine. PHP Error logging is also working, but I want the errors to display on the page so I dont have to look at the error log every 5 minutes.

还有什么可能是引起这个?

What else could be causing this?

推荐答案

如果你将自定义错误设置为详细错误页面的功能设置中的code>

IF you set custom error to Detailed in feature settings of error pages for website and server both

AND 如果在你的 php.ini 文件中你设置 display_errors = on & error_reporting = E_ALL

AND if in your php.ini file you set the display_errors = on & error_reporting = E_ALL

然后只有一种可能性[IIS默认500错误页面是您的PHP无法正常运行错误配置。

THEN there is only one possibility for getting [IIS default 500 error page] is that "Your PHP is not working coz of miss configuration."

所需的配置为:

Handler Mappings 设置为php-cgi.exe文件(在php安装目录中)作为FastCGI,打开 php.ini 文件并编辑以下行或在文件中添加(如果未找到)。 (如果PHP安装目录中不存在php.ini,则从现有的php.ini-development或php.ini-production重命名)

After setting Handler Mappings to your php-cgi.exe file(which is in you php installation dir) as FastCGI, open the php.ini file and edit following lines OR add if not found in file. (if php.ini is not exists in you PHP installation dir then rename from existing php.ini-development OR php.ini-production)

1) extension_dir =ext \

; ext文件夹将在PHP中安装,如果没有创建且不要忘记结束\\ \\

;ext folder will be in PHP installation, if not create and don't forget ending \

2) log_errors = On

3 ) error_log =C:\inetpub\temp\php-errors.log

4) cgi.force_redirect = 0

;可能你需要添加这一行将其添加到任何地方,例如 - 之前';文件上传;'

; may be you need to add this line add it anywhere, for instance-before '; File Uploads ;'

5) cgi.fix_pathinfo = 1

6) fastcgi.impersonate = 1

7) fastcgi.logging = 0

 Be careful and there should not `;` before any of these lines.

参见文档 - 安装/配置PHP

即使在正确配置之后,由于系统损坏,PHP可能无法正常工作。您可以通过双击 php-cgi.exe php-win.exe 来检查它应该运行没有正确的错误(其他警告或 ext / fileName ... 缺少消息 - 这些都没问题。)

Even after correct configurations PHP may not work because of system corruption. You can check by double click on php-cgi.exe and php-win.exe it should run without proper error (other then warnings OR ext/fileName... is missing messages - these are OK).

注意:在这些许多其他设置之后需要运行php的所有内容(例如会话),但是通过这些简单的PHP将工作或PHP将正确显示错误(错误500页)。

Note: after these many other setting are requires to run all things of php (ex. session), but by these SIMPLE PHP WILL WORK or PHP will properly show the error for what's wrong (NOT 500 page).

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

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