On Tue, February 27, 2007 7:17 am, h wrote: > I have been using the shell_exec command to perform several server > queries quite succesfully i.e. analysing files systems by gettin > ginformation returned by df -kP (shell_exec('df -kP')). do any of you > guts know if it is possible to target a command like this on another > server? > > So from server A where I am running a web app, needs to run the > shell_exec('df -kP') on server B, which also has php installed, so > that i can display the results in my web app on server A. Hope that > makes sense! > > Also, how would i fopen a file such as /proc/cpuinfo on Server B from > Server A. Well, there are several options here. One option is to just build a password-protected web page on the other server that does the exec() (or readfile for cpuinfo). Then you can have PHP on server A do file_get_contents on the URL, if allow_url_fopen is "ON" Depending on how complex the target command is, you could also look into running WebServices such as SOAP, RPC, REST, etc. A valuable source of this kind of thing is from the zillion "control panels" for webhosting that are "out there" I think you might maybe be able to tunnel a command through SSH as a one-off, but perhaps I'm just dreaming I read about that in man ssh a few months ago. To a large degree, HOW you do this depends much more on what commands you want to allow, and even more importantly, disallow, than on anything involving PHP. In fact, PHP itself is only a thinly-disguised wrapper for whatever you will come up with. So you're better off asking about this kind of thing on an OS or Linux distribution mailing list, probably. The PHP bit will end up just being <?php exec("$something")?> no matter how you look at it. -- Some people have a "gift" link here. Know what I want? I want you to buy a CD from some starving artist. http://cdbaby.com/browse/from/lynch Yeah, I get a buck. So? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php