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

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

报告相同问题?

悬赏问题

  • ¥18 深度学习tensorflow1,ssdv1,coco数据集训练一个模型
  • ¥100 关于注册表摄像头和麦克风的问题
  • ¥30 代码本地运行正常,但是TOMCAT部署时闪退
  • ¥15 关于#python#的问题
  • ¥15 主机可以ping通路由器但是连不上网怎么办
  • ¥15 数据库一张以时间排好序的表中,找出多次相邻的那些行
  • ¥50 关于DynamoRIO处理多线程程序时候的问题
  • ¥15 kubeadm部署k8s出错
  • ¥15 Abaqus打不开cae文件怎么办?
  • ¥15 小程序准备上线,软件开发公司需要提供哪些资料给甲方