#30060 [Fbk->NoF]: Fatal Error is reported when calling winmgmt COM object
| From: | sniper@php.net | Date: | Tue, 28 Sep 2004 21:19:39 +0000 |
| Subject: | #30060 [Fbk->NoF]: Fatal Error is reported when calling winmgmt COM object | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-66835@lists.php.net to get a copy of this message | ||
ID: 30060
Updated by: sniper@php.net
Reported By: Michael dot Rivera at Ceridian dot com
-Status: Feedback
+Status: No Feedback
Bug Type: COM related
Operating System: Windows 2000
PHP Version: 5.0.1
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2004-09-11 10:45:22] wez@php.net
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.
------------------------------------------------------------------------
[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