#30060 [Bgs->Fbk]: Fatal Error is reported when calling winmgmt COM object
| From: | wez@php.net | Date: | Sat, 11 Sep 2004 08:45:25 +0000 |
| Subject: | #30060 [Bgs->Fbk]: Fatal Error is reported when calling winmgmt COM object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66049@lists.php.net to get a copy of this message | ||
ID: 30060
Updated by: wez@php.net
Reported By: Michael dot Rivera at Ceridian dot com
-Status: Bogus
+Status: Feedback
Bug Type: COM related
Operating System: Windows 2000
PHP Version: 5.0.1
New Comment:
Check this out:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/constructing_a_moniker_string.asp
Someone recently reported to me that they needed to set the
impersonation level, as shown towards the end of that page.
Previous Comments:
------------------------------------------------------------------------
[2004-09-11 02:59:24] pollita@php.net
Sorry, but your problem does not imply a bug in PHP itself. For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system
is not the
appropriate forum for asking support questions.
Thank you for your interest in PHP.
winmgmts://./root/cimv2 is not a valid com object name so COM couldn't
instantiate it, therefore it threw an exception.
You didn't catch the exception and all uncaught exceptions are fatal.
------------------------------------------------------------------------
[2004-09-10 23:49:23] Michael dot Rivera at Ceridian dot com
Description:
------------
When trying to call the com object winmgmt I get the following error.
Fatal error: Uncaught exception 'com_exception' with message 'Failed to
create COM object `winmgmts://./root/cimv2': ' in
C:\Inetpub\wwwroot\sqladministrator\wmitest.php:4 Stack trace: #0
{main} thrown in C:\Inetpub\wwwroot\sqladministrator\wmitest.php on
line 4
Reproduce code:
---------------
<?php
$hostname = ".";
//com_print_typeinfo ("winmgmts://./root/cimv2");
$wmi = new COM("winmgmts://./root/cimv2");
$names = $wmi->ExecQuery("Select Name, Manufacturer, Model,
NumberOfProcessors, TotalPhysicalMemory
from Win32_ComputerSystem");
foreach ($names as $system)
{
echo trim($system->Name).'<br>Manufacturer:
'.($system->Manufacturer).
'<br> Model: '.($system->Model).'<br> Number of
Processors:'.($system->NumberOfProcessors).
'<br> Physical Memory: '.(($system->TotalPhysicalMemory/1024)/1024).'
Mg';
}
?>
Expected result:
----------------
The manufacturer, the number of procesors and amount of physical memory
on the server that this is run on.
Actual result:
--------------
Fatal error: Uncaught exception 'com_exception' with message 'Failed to
create COM object `winmgmts://./root/cimv2': ' in
C:\Inetpub\wwwroot\sqladministrator\wmitest.php:4 Stack trace: #0
{main} thrown in C:\Inetpub\wwwroot\sqladministrator\wmitest.php on
line 4
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=30060&edit=1