473,395 Members | 1,689 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,395 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 3219
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
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.