为什么exec和proc_open在IIS的不同用户下运行


Why are exec and proc_open running under different user on IIS?

我在Windows Server 2012 R2和IIS 8.5上运行我的网站,遇到了一个问题。

  • 当我运行exec('whoami')时,它会返回nt authority'iusr
  • 当我运行proc_open('whoami', $desc, $pipes)时,结果是iis apppool'mysite

为什么会发生这种情况?

这很有趣。这一定与proc_open的性质有关。不知怎的,它会进入共享iis池,该池与iis上使用的标准用户具有不同的权限。proc_open可能已经知道请求更高级别的控制,而windows下的php可能需要额外的权限才能获得。