IIS PHP doesn't log errors to log file

2020-03-31 03:42发布

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?

3条回答
淡お忘
2楼-- · 2020-03-31 04:28

In the IIS server manager tool, there is option call error page. Please disable to use the IE error page to show you the error.

Besides please go to the C:\inetpub\wwwroot\web.config this file controls how to display and log the error as well. It should have one line like this. <httpErrors errorMode="Detailed" />

查看更多
不美不萌又怎样
3楼-- · 2020-03-31 04:34

Do you have php.ini in right setup according to this?

http://php.net/manual/en/install.windows.manual.php

specially keys log_errors and error_log

查看更多
再贱就再见
4楼-- · 2020-03-31 04:48

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.

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.

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.

Hope that helps.

查看更多
登录 后发表回答