| 
        php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login | 
 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits             
             [2004-09-11 02:59 UTC] pollita@php.net
  [2004-09-11 10:45 UTC] wez@php.net
  [2004-09-28 23:19 UTC] sniper@php.net
  | 
    |||||||||||||||||||||||||||||||||||||
            
                 
                Copyright © 2001-2025 The PHP GroupAll rights reserved.  | 
        Last updated: Tue Nov 04 14:00:01 2025 UTC | 
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