dongshu4221 2019-06-14 14:05
浏览 156
已采纳

PHP无法使用Edge和Windows身份验证在IIS中写入文件

I am running PHP through IIS on windows, and using the Integrated Authentication for using domain users.

The following code works when accessing a page in IE 11, Chrome and Firefox.

$dir = dirname(__FILE__);
$dir = realpath($dir.'/../storage/logs');

$filename = $dir.DIRECTORY_SEPARATOR.'my-log.log';
file_put_contents($filename, 'hello world');

When accessed in MS Edge

PHP Warning: file_put_contents(C:\websites\my-site\api\storage\logs\my-log.log): 
failed to open stream: Permission denied in 
C:\websites\my-site\api\public\permissions.php on line 11 

(It works in the Edge-Dev that is based on Chromium, it is only a problem in the traditional / EdgeHTML version that has the problem.)

The code works in Edge too if I turn off the windows authentication. I know that I am typing my password correctly because if I don't I get a 401 unauthorised message from IIS.

This issue is not just my computer; it has failed on all 4 laptops we've tried it on. But does not seem to affect servers, only desktop Windows.

Update

As per Deepak-MSFT's suggestion I added my computer's name to the intranet, but it didn't change anything. The name is like laptop-4.example.com I added it both with and without http and *.example.com was already in trusted sites, leaving it in or removing it does not seem to change anything.

  • 写回答

1条回答 默认 最新

  • douyi2664 2019-06-26 15:32
    关注

    It appears that for some reason Edge seems to prefer having NTLM before Negotiate in the list. Don't know why, but it has solved the problem. I can reliably revert back to Negotiate to cause the issues again, so its pretty likely to be the cause.

    Auth setting location

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 js,页面2返回页面1时定位进入的设备
  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥15 绘制多分类任务的roc曲线时只画出了一类的roc,其它的auc显示为nan
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀