I'm trying to access WMI using COM objects with PHP. The method below works very well with PHP on browser, but I can't make it work when the PHP file compiled as a Windows console application.
$obj = new COM ( 'winmgmts://localhost/root/CIMV2' );
$fso = new COM ( "Scripting.FileSystemObject" );
$csp = $obj->ExecQuery("Select * from Win32_ComputerSystemProduct");
foreach ( $csp as $wmi_csp )
{
$uuid = $wmi_csp->UUID;
}
I've tried Bambalam BamCompiler, PHC-Win and Phalanger. Bambalam failed to work, but didn't return any error messages. Phalanger failed to identify "COM Object". I noticed that the required PHP Extension is called "php_com_dotnet.dll". But Phalanger does not come with this extension.
I tried to add it to the extensions library, but Phalanger Extutil fails to make a wrapper for it (note that php_com_dotnet.dll's version I copied to the extensions folder does not match with the other extensions' file version).
How can I use COM object, and with which PHP compiler under Windows? Or how can I make Phalanger to accept required extension?