473,325 Members | 2,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,325 software developers and data experts.

Help with Passthru and wmic...

I'm trying to get this to work..

<?php
echo passthru('wmic cpu get loadpercentage');
?>

and just output to the browser... It looks like cmd.exe hangs when it
tries to execute the command. The IUSR_ account has access to both the
cmd.exe and wmic files. I have also tried copying the wmic files to
the C:\php dir, and to the directory the web app is running from. Any
ideas?

Spudster

Jul 29 '05 #1
1 3214
Sp*******@gmail.com wrote:
I'm trying to get this to work..

<?php
echo passthru('wmic cpu get loadpercentage');


and just output to the browser... It looks like cmd.exe hangs when it
tries to execute the command. The IUSR_ account has access to both
the cmd.exe and wmic files. I have also tried copying the wmic files
to the C:\php dir, and to the directory the web app is running from.
Any ideas?


You will have to use proc_open to start a process in read/write mode;
example:

$descriptorspec = array(
array('pipe','r'),
array('pipe','w')
);

$process = proc_open("wmic", $descriptorspec, $pipes);
fwrite($pipes[0], 'cpu get loadpercentage');
fclose($pipes[0]);

print stream_get_contents($pipes[1]);
fclose($pipes[1]);
JW

Jul 30 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Rafal 'Raf256' Maj | last post by:
Hi, Warning: passthru() has been disabled for security reasons in ... how can I change my php.ini file (php4/apache/winxp server) to enable this function? How can I best work around if I can't...
0
by: Yemi | last post by:
Hi There. I seem to be getting some inconsistent results when using passthru() in safe mode. They appear to be related to the fact that passthru should treat all command arguments as one single...
3
by: Jerry | last post by:
I've found a problem with exec, passthru, shell_exec & system. I'm trying to run the following exec("sort -r -n -k2,2 r1.txt > r2.txt") with r1.txt being a numeric file. The file looks like...
2
by: Martin Kofahl | last post by:
Hello, I'm slightly confused with the passthru() command. The program I call writes html headers itself. However, passthru() makes apache sending some generated headers first. There's no fault...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
1
by: yossisht | last post by:
Hello, I am trying to change a service from running under System Account to Domain User account. I a running the following command: wmic service <ServiceName> call change StartName =...
3
by: niskin | last post by:
Hi I'm trying to use wmic (the WMI command-line) to start notepad.exe. I know that I need to type "cscript //nologo CreateProcess.vbs TestPC %windir%\system32\notepad.exe %temp%" into command...
1
by: kmazaika | last post by:
Hi, I'm developing software for a USB device with an FTDI chip. The device is recognized through WMIC queries. When porting an application from Visual Studio 2003, to 2005 it seems to work...
5
by: amalprakash3220 | last post by:
Hi, I want to implement a Web based System administration page in PHP. I'm planning to use apache server, mySQL and Ubuntu/debian. Can I implement it using the functions passthru(),exec() and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.