PHP5.2.17如何在Win7上获取服务状态


How PHP5.2.17 get service status on Win7

我将一个PHP网站从win2003sp2 Standard移到了win7 Enterprise。一切都没有改变。该网站在win2003中运行正常。但在win7中,当通过win32_query_service_status()获得服务状态时,返回WIN32_ERROR_ACCESS_DENIED

我想不通。


作为Dan提供的链接,我知道Win2003和后来的Windows对于远程身份验证用户来说是不同的。这是我无法通过我的网站页面获得服务状态的根本原因吗?

报价:Windows Server 2003 and Windows XP: Remote authenticated users are granted the SC_MANAGER_CONNECT, SC_MANAGER_ENUMERATE_SERVICE, SC_MANAGER_QUERY_LOCK_STATUS, and STANDARD_RIGHTS_READ access rights. These access rights are restricted as described in the previous table as of Windows Server 2003 with SP1

访问权限自win2003sp1起受到限制。但该网站在win2003sp2上运行正常。我认为这可能不是根本原因。

运行PHP的用户对SCM数据库没有正确的权限。有关详细信息,请参阅此处:http://msdn.microsoft.com/en-us/library/windows/desktop/ms685981(v=vs.85).aspx

WIN32_ERROR_ACCESS_DENIED错误是php.net上提到的"The handle to the SCM database does not have the appropriate access rights"

检查当前用户对可能有帮助的文件夹的权限。。

最后,更改win32_query_service_status()所在文件夹的身份验证,如下所示,解决了我的问题。

  1. 匿名身份验证-已禁用
  2. Windows身份验证-已启用