Page 1 of 1
accessing other apps
Posted: Tue Mar 02, 2004 9:55 am
by Deemo
well, i am designing a small page that will allow me to view information that is viewed in a shell prompt. is there any way of doing that with php?
what i want it to do specifically is to execute a command in an existing shell, and then import the information and display it in a user friendly way
any help would be greatly appreciated
thanks
Deemo

Posted: Tue Mar 02, 2004 9:57 am
by markl999
Try one of the program execution functions
http://php.net/exec
Posted: Tue Mar 02, 2004 10:11 am
by Deemo
thanks for the reply, and that does help
but i need to be able to access an already existing terminal. i have no idea how to do that.
for example:
lets say i have ./example running when i type in ps -eaf
how do i make it so i can "open" ./example so i can see all it returns?
if i want to go into ./example and run the command "status", i know i would use shell_exec() or something, but the program doesnt know which terminal to use the command "status" in.
this might seems confusing, but the way i imagine it is that then u use shell_exec() it activates its own new shell instead of an existing one.
Posted: Tue Mar 02, 2004 10:18 am
by markl999
Hmm, not sure that would be possible. If you have control over this shell script would it be possible for you to alter it, so that when you type 'status' it outputs and also outputs to a file, maybe status.txt, and have PHP parse this file rather than try to access the shell directly?
Posted: Tue Mar 02, 2004 12:50 pm
by Deemo
wont be able to do that because the program is already compiled and i dont think i will be able to get the source code
and if this isnt possible with php, what can it be made in?
Posted: Tue Mar 02, 2004 5:22 pm
by d3ad1ysp0rk
what about doing your first one, then closing that prompt and opening a new one..?
Posted: Tue Mar 02, 2004 8:02 pm
by Deemo
wont be able to do that
this is suposed to be like a "server tracker" for a game server i own, and to shut it down would be to drop clients
ive seen this done is ASP, is there no way to do this is php???
Posted: Wed Mar 03, 2004 6:15 pm
by Deemo
can no one figure this out???
Posted: Wed Mar 03, 2004 7:47 pm
by Weirdan
You can try to start the program using the screen command. Then you can use [php_man]proc_open[/php_man] to connect a pipe to the program under the screen's control.
Posted: Wed Mar 03, 2004 7:49 pm
by Weirdan
Here is an interesting thread on this topic:
http://dbforums.com/arch/182/2003/1/670383