Execute system commands from PHP

System commands can be executed from PHP using exec command.
eg:

$out = array();
$command = "memcat --server=10.10.10.10 ITEMS > /tmp/items.txt";
exec($command, $out);
The $out variable would hold the output of the command. If there is any issue with executing a command , have the command with path.
eg:
$command = "/usr/local/bin/memcat --server=10.10.10.10 ITEMS > /tmp/items.txt";
exec($command, $out);
for further info: http://www.php.net/manual/en/function.exec.php

0 comments



Some Links (off programming)