From: Michael dot Rivera at Ceridian dot com
Operating system: Windows 2000
PHP version: 5.0.1
PHP Bug Type: COM related
Bug description: Fatal Error is reported when calling winmgmt COM object
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 bug report at http://bugs.php.net/?id=30060&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30060&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30060&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30060&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30060&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30060&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30060&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30060&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30060&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30060&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30060&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30060&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30060&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30060&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30060&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30060&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30060&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30060&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30060&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30060&r=mysqlcfg