#33086 [NEW]: Weird COM behavior differences in CGI and CLI
| From: | hmp96 at yahoo dot co dot uk | Date: | Fri, 20 May 2005 15:18:00 +0000 |
| Subject: | #33086 [NEW]: Weird COM behavior differences in CGI and CLI | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-79270@lists.php.net to get a copy of this message | ||
From: hmp96 at yahoo dot co dot uk
Operating system: Windows XP SP2
PHP version: 5.0.4
PHP Bug Type: COM related
Bug description: Weird COM behavior differences in CGI and CLI
Description:
------------
I am having some weird differences when using COM in a CGI
environment while it works fine in a CLI environment.
Basically, I am querying the "WinMgmts:" using COM and the
WMI's WQL query I provide is "Select * From Win32_Product".
All fields are retrieved fine, except for the Vendor field
which is sometimes lacking information; this only happens
when the script is running in a CGI environment, but the
values are retrieved fine in a CLI environment, i.e. script
run from the command line.
The script in the "Reproduce Code" section will suffice
when testing in CGI and a CLI environment. Note, if you
are having problem running a WMI related script on IIS,
thats probably because the security needs to be tweaked
using WMI Control snap-in from MMC.
Reproduce code:
---------------
<pre>
<?php
$wmi = new COM("WinMgmts:root/cimv2");
$colProducts = $wmi->ExecQuery("Select * From Win32_Product");
echo "Applications Installed on Local Machine\r\n";
try {
foreach($colProducts as $objProduct) {
printf("Name: %s, Version: %s, Vendor: %s\r\n",
$objProduct->Name, $objProduct->Version, $objProduct->Vendor);
}
} catch (Exception $e) {
echo $e->GetMessage();
}
?>
</pre>
Expected result:
----------------
When run, it should fill the 'Vendor' field of the
Win32_Product class in a CGI/ISAPI environment. Basically
it should be same as the CLI environment's output. Even
some of the applications are missing when run in a CGI
environment.
Here is the CGI instance of the PHP script:
Applications Installed on Local Machine
Name: WebFldrs XP, Version: 9.50.5318, Vendor: Microsoft Corporation
Name: GFI LANguard Network Security Scanner 5.0, Version: 5.0.2004.0728,
Vendor: GFI Software Ltd.
Name: Adobe Reader 6.0.1, Version: 006.000.001, Vendor: Adobe Systems
Incorporated
Name: McAfee VirusScan Enterprise, Version: 7.1.0, Vendor: Network
Associates
Name: Belkin Bluetooth Software, Version: 1.4.2.10, Vendor:
Name: ActivePerl 5.8.6 Build 811, Version: 5.8.811, Vendor: ActiveState
Name: FileMaker Pro 6, Version: 6.0.1.0, Vendor: FileMaker, Inc.
Name: Java 2 Runtime Environment, SE v1.4.2_03, Version: 1.4.2_03, Vendor:
Name: Microsoft Office Professional Edition 2003, Version: 11.0.6361.0,
Vendor: Microsoft Corporation
Name: HP Deskjet 3840, Version: 1.00.0000, Vendor:
Name: MSN Messenger 7.0, Version: 7.0.0777, Vendor: Microsoft Corporation
Name: Microsoft .NET Framework 1.1, Version: 1.1.4322, Vendor: Microsoft
Name: HighMAT Extension to Microsoft Windows XP CD Writing Wizard,
Version: 1.1.1905.1, Vendor: Microsoft Corporation
Name: VMware Workstation, Version: 4.0.0.4460, Vendor:
Actual result:
--------------
<pre>
Applications Installed on Local Machine
Name: WMI Tools, Version: 1.50.1131.0001, Vendor: Microsoft Corporation
Name: MySQL Query Browser 1.1, Version: 1.1.5, Vendor: MySQL AB
Name: WebFldrs XP, Version: 9.50.5318, Vendor: Microsoft Corporation
Name: GFI LANguard Network Security Scanner 5.0, Version: 5.0.2004.0728,
Vendor: GFI Software Ltd.
Name: Adobe Reader 6.0.1, Version: 006.000.001, Vendor: Adobe Systems
Incorporated
Name: McAfee VirusScan Enterprise, Version: 7.1.0, Vendor: Network
Associates
Name: Belkin Bluetooth Software, Version: 1.4.2.10, Vendor: WIDCOMM, Inc.
Name: ActivePerl 5.8.6 Build 811, Version: 5.8.811, Vendor: ActiveState
Name: FileMaker Pro 6, Version: 6.0.1.0, Vendor: FileMaker, Inc.
Name: Java 2 Runtime Environment, SE v1.4.2_03, Version: 1.4.2_03, Vendor:
Sun Microsystems, Inc.
Name: Microsoft Office Professional Edition 2003, Version: 11.0.6361.0,
Vendor: Microsoft Corporation
Name: HP Deskjet 3840, Version: 1.00.0000, Vendor: Hewlett-Packard
Name: MSN Messenger 7.0, Version: 7.0.0777, Vendor: Microsoft Corporation
Name: Microsoft .NET Framework 1.1, Version: 1.1.4322, Vendor: Microsoft
Name: HighMAT Extension to Microsoft Windows XP CD Writing Wizard,
Version: 1.1.1905.1, Vendor: Microsoft Corporation
Name: VMware Workstation, Version: 4.0.0.4460, Vendor: VMware, Inc.
</pre>
--
Edit bug report at http://bugs.php.net/?id=33086&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=33086&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=33086&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=33086&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=33086&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=33086&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=33086&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=33086&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=33086&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=33086&r=support
Expected behavior: http://bugs.php.net/fix.php?id=33086&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=33086&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=33086&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=33086&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=33086&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=33086&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=33086&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=33086&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=33086&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=33086&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=33086&r=mysqlcfg