Re: [PHP] Capturing shell command output.

2007-08-27 Thread Richard Lynch
On Mon, August 27, 2007 2:43 am, shiplu wrote: > I have tried same file as cli and as webpage. I don't know why only > cli version works nicely. There may be some issue. But my technique > has some advantages. It can run command asynchronously. Thats what i > need for my application. I can create

Re: [PHP] Capturing shell command output.

2007-08-27 Thread shiplu
On 8/27/07, Richard Lynch <[EMAIL PROTECTED]> wrote: > You could look into using "named pipes" in PHP. > > I think PHP is already folding stderr into stdout (2>&1) for you. > > You could also try using http://php.net/exec instead of the backticks > to get a separate error code if there is an error.

Re: [PHP] Capturing shell command output.

2007-08-18 Thread Wouter van Vliet / Interpotential
You may want to look into shell_exec, which executes a command and returns the output. If you're accepting arguments from user input, don't forget proper use of escapeshellcmd and escapeshellarg ;-). Something else that might cause your commands from failing, is that the utilities are not inside a

[PHP] Capturing shell command output.

2007-08-18 Thread shiplu
HI, I am working on a PHP project that interacts with command line utilities. My php is running by apache. Means I am not running any php CLI. here is the function that I am using for capturing command output. function run_command($comamnd){ $ret=`$command 1> COMMAND.OUT 2>1`; $contents=get_file