Executing shell command?
| From: | Jas | Date: | Tue, 23 Sep 2008 13:27:22 +0000 |
| Subject: | Executing shell command? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-280763@lists.php.net to get a copy of this message | ||
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'] );