I am on a Mac OS X server and I am trying to one of two things… if I can get either one to work I’d be happy.
First, I’m trying to do a system call to get the running processes. Doing a “ps -cx” in PHP give me a different set of processes than when I type it into the terminal window. I need the set that is returned in the terminal window. I also need to redirect it into a file so I can see if the process I want is running since I don’t think I can check the output of the system call in the PHP script.
Second, if I can’t get the proper set of processes back using a php system call I can run a simple C program that can do it, but I can’t seem to call the C program from PHP.
Here is the code I’ve testing with :
[code]
system(“ps -cx”); echo “<br>”;
system(“ps -cx > SystemCheckFile.txt”);
system(/User/administrator/C Apps/SystemCall/SystemCall”);
The first one echos out the processes but all I get back is a series of httpd processes.
The second one is supposed to redirect the output to the fiel SystemCheckFile.txt, but I can’t find it anywhere on my computer which leads me to believe that the file is not getting creatied.
The third one calls a C program that does the same thing as the second call except when I run the program on it’s own, I get all the processes that I am expecting, such as Netscape, Finder, Dreamweaver..etc…
If anyone has a suggestion, I am willing to listen ?
– sharyn