Re: Executing shell command?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux