On Tue, 2008-09-23 at 14:43 +0100, Stut wrote: > On 23 Sep 2008, at 14:27, Jas wrote: > > Ok I am having problems with a command I would like to execute > > through PHP. > > > > I have tried simple backtick operators on the command, passthru, > > exec, system all with the same results of 0 return code. > > > > Here is an example of the command I am attempting to execute if > > someone could provide me with some insight, examples etc. > > > > /usr/bin/dnssec-keygen -a HMAC-MD5 -b 128 -n USER key (which works > > from a terminal) > > > > Here is my php code (I am changing into a writable directory which > > works fine): > > chdir( $defined['keys'] ); > > $cmd = $defined['dnssectool'] . " -a " . $algorithm . " -b " . > > $key_bit . " -n USER " . $key_name; > > echo $cmd . "<br>"; > > system( '$cmd', $ret ); > > chdir( $defined['virpath'] ); > > Use backticks and add 2>&1 after the command to redirect stderr to > stdout. If that still returns check that the user running the PHP > script has permission to execute that command. > > -Stut > > -- > http://stut.net/ > Also, some commands will return output. Normally this would be displayed on the command line, but in your case you should pass it through to /dev/null with a pipe, for example: /bin/somescript >/dev/null & The ampersand (&) just instructs PHP to run the command in the background, which is useful for things that you expect to take a while. Ash www.ashleysheridan.co.uk -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php