我在 Windows Server 2008 R2 上使用 IIS 7.5 以及通过 FastCGI 的 PHP 5.5 NTS。 不知何故,我的 PHP 不想将错误记录到文件中。该文件永远不会创建,当我手动创建它时,PHP 不会写入它。
这是我的 php.ini(已验证,它是用 phpinfo(); 加载的)
error_reporting = E_ALL & ~E_DEPRECATED & ~E_STRICT
log_errors = On
error_log = "C:\inetpub\logs\php\php_errors.log"
指定的目录对 IIS_IUSRS、IUSR 甚至 AppPool 用户具有写入权限(是的,我知道它是多余的,只是为了确保)。 我什至打开 display_errors 查看是否有错误,它确实在我的浏览器中显示了错误,但 PHP 仍然不想写错误日志。
编辑:[已解决]
我在我的网站上使用 BasicAuthentication,IIS 会模拟您登录时使用的用户。因此,我刚刚将我的登录用户帐户添加到 IIS_IUSRS 组,现在它可以工作了。
最佳答案
将此添加为解决方案文本,这样它就不会再出现在“未回答的问题”列表中。答案由问题作者在上面编辑的问题中提供:
Edit: [SOLVED]
I was using BasicAuthentication for my website and there the IIS impersonates the user you are logging in with. Therefore I just added my log on user account to the IIS_IUSRS group and now it works.
关于IIS 上的 PHP 错误日志不写入文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17765116/