From: steve at qzed dot com
Operating system: Windows 2000
PHP version: 4.3.8
PHP Bug Type: COM related
Bug description: Can access properties but no methods of Win32_Process object
Description:
------------
I am using the COM object of PHP to access WMI.
I can access Win32_Process objects and display their property values.
When I try to use Win32_Process method SetPriority I get a PHP error:
'Unable to lookup setpriority: Unknown name.'
Reproduce code:
---------------
<?php
set_time_limit(0);
$shell = new COM("WScript.Shell");
$cmd = 'php.exe st1.php';
$st1 = $shell->Exec($cmd);
echo $cmd." Started as ProcessID ".$st1->ProcessID."\n";
$wmi = new
COM('WinMgmts:{impersonationLevel=impersonate}!//./root/cimv2');
$query = "Select * from Win32_Process where ProcessID =
".$st1->ProcessID;
$stillRunning = true;
while ($stillRunning) {
$stillRunning = False;
$processes = $wmi->ExecQuery($query);
while ($process = $processes->Next()) {
if ($process->ProcessID == $st1->ProcessID) {
echo "process ".$process->ProcessID." still running\n";
echo "process ".$process->ProcessID." priority is
".$process->Priority."\n";
$priority = 128;
$process->SetPriority($priority); //high
$stillRunning = true;
}
}
sleep(2);
}
echo "process ".$st1->ProcessID." ended";
?>
Expected result:
----------------
D:\d2>php tm.php
Content-type: text/html
X-Powered-By: PHP/4.3.8
php.exe st1.php Started as ProcessID 1052
process 1052 still running
process 1052 priority is 8
process 1052 still running
process 1052 priority is 8
process 1052 still running
process 1052 priority is 8
^C
Actual result:
--------------
D:\d2>php tm.php
Content-type: text/html
X-Powered-By: PHP/4.3.8
php.exe st1.php Started as ProcessID 1488
process 1488 still running
process 1488 priority is 8
<br />
<b>Warning</b>: (null)(): Unable to lookup setpriority: Unknown name.
in <b>D:\d2\tm.php</b> on line <b>31</b><br />
process 1488 still running
process 1488 priority is 8
<br />
<b>Warning</b>: (null)(): Unable to lookup setpriority: Unknown name.
in <b>D:\d2\tm.php</b> on line <b>31</b><br />
process 1488 still running
process 1488 priority is 8
<br />
<b>Warning</b>: (null)(): Unable to lookup setpriority: Unknown name.
in <b>D:\d2\tm.php</b> on line <b>31</b><br />
process 1488 still running
process 1488 priority is 8
<br />
<b>Warning</b>: (null)(): Unable to lookup setpriority: Unknown name.
in <b>D:\d2\tm.php</b> on line <b>31</b><br />
^C
--
Edit bug report at http://bugs.php.net/?id=30265&edit=1
--
Try a CVS snapshot (php4): http://bugs.php.net/fix.php?id=30265&r=trysnapshot4
Try a CVS snapshot (php5.0): http://bugs.php.net/fix.php?id=30265&r=trysnapshot50
Try a CVS snapshot (php5.1): http://bugs.php.net/fix.php?id=30265&r=trysnapshot51
Fixed in CVS: http://bugs.php.net/fix.php?id=30265&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=30265&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=30265&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=30265&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=30265&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=30265&r=support
Expected behavior: http://bugs.php.net/fix.php?id=30265&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=30265&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=30265&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=30265&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=30265&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=30265&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=30265&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=30265&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=30265&r=float
MySQL Configuration Error: http://bugs.php.net/fix.php?id=30265&r=mysqlcfg