IIS PHP不会将错误记录到日志文件中 [英] IIS PHP doesn't log errors to log file

查看:122
本文介绍了IIS PHP不会将错误记录到日志文件中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的本​​地Windows Web服务器(IIS)不会将php错误记录到日志文件.php53_errors.log文件始终为空。 http://prntscr.com/2aels 如何解决?我认为权限设置出了问题。但它在浏览器窗口中显示错误。还有一个问题:像Undefined index这样的通知..它们真的很重要吗?

My local windows webserver (IIS) doesn't log php errors to log file.The php53_errors.log file is always empty. http://prntscr.com/2aels How to fix it? I think something goes wrong with permission settings. But it shows errors on browser window. And, one more question:Notices like "Undefined index".. Are they really important?

推荐答案

阅读你的最后一部分问题:

Read the last part of your question:


类似未定义索引的通知..它们真的很重要吗?

Notices like "Undefined index".. Are they really important?

这取决于你对'重要'的定义。

It depends on your definition of 'important'.

简单的答案是否定的,它们并不重要。这就是他们被归类为通知而不是警告的原因。可以忽略它们。

The easy answer is no, they're not important. That's the reason they're classified as notices rather than warnings. It's okay to ignore them.

但是你仍然应该注意它们,并尽可能地修复它们。

However you should still pay attention to them, and try to fix them where possible.

例如,您引用未定义索引的通知。通过引用尚未定义的数组元素引起这种情况(我确信您已经知道)。

For example, the notice you quoted "Undefined index". This is caused (as I'm sure you're aware) by referencing an array element that hasn't yet been defined.

最佳做法是阻止此通知通过使用 isset()来筹集,因为如果你这样做,那么当你仍然得到通知时,你会知道这很重要 - 也许你输了一个错字在您的变量名称或数组索引?代码仍然会运行,但它无法正常工作,获取通知可能是您的第一个线索。如果该通知被合法的通知压制或淹没,您将永远不会发现它。

It is best practice to prevent this notice from being raised by using isset(), because if you do that, then when you do still get the notice, you'll know it is important - maybe you made a typo in your variable name or array index? The code will still run, but it won't work properly, and getting the notice might be the first clue you have of that. If that notice is suppressed or drowned out by legitimate ones, you'll never spot it.

PHP提出的大多数'通知'与此类似 - 他们表示可能出现问题,但PHP并不确定。如果你在防御性地编写代码以防止在你对代码感到满意时提出通知,那么你可以更多地关注那些仍然出现的代码。

Most 'notices' raised by PHP are on a similar level to that -- they indicate that something might be wrong, but PHP doesn't know for sure. If you write your code defensively to prevent notices from being raised when you're happy with the code, then you can afford to pay more attention to the ones that do still crop up.

希望有所帮助。

这篇关于IIS PHP不会将错误记录到日志文件中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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