ID: 30265
User updated by: steve at qzed dot com
Reported By: steve at qzed dot com
-Status: Open
+Status: Bogus
Bug Type: COM related
Operating System: Windows 2000
PHP Version: 4.3.8
New Comment:
This isn't an issue with PHP.
The SetPriority method on the Win32_Process Method is only available on
Windows XP and Windows 2003.
Previous Comments:
------------------------------------------------------------------------
[2004-09-28 20:36:29] steve at qzed dot com
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 this bug report at http://bugs.php.net/?id=30265&edit=1