Entry
How can I read all unix processes from PHP?
Can I kill unix processes from PHP?
How can I insert a sudo command in a php script? I inserted it as $fun="sudo less ~home/guest/aa.txt
Jan 12th, 2000 05:20
Nathan Wallace, Ajantha Wijeratna, Fredrik Rovik
You can return a list of processes with the unix command:
ps
You can probably pipe it trough awk to return only the important
processes.
<?
$fp=popen("/bin/ps -aux","r");
while (!feof($fp)) {
$buffer = fgets($fp, 4096);
echo nl2br($buffer);
}
?>
To kill processes you will need to run a command as root or the owner of
the process. You might be able to do this using sudo or similar.