Snake Eyes
Snake Eyes

Reputation: 16754

Execute external program with PHP and arguments

I wish to run external program with PHP and provide some arguments, like:

exec('C:\\Program Files\\iNFekt\\infekt\\infekt-cmd.exe -S --utf-16 '.$nfoFile, $output, $return_var);

But nothing happens, $output is empty array, $return_var is 1

What is my mistake here ?

Upvotes: 2

Views: 57

Answers (1)

user2342558
user2342558

Reputation: 6693

Use shell_exec to get the output:

$output = shell_exec('C:\\Program Files\\iNFekt\\infekt\\infekt-cmd.exe -S --utf-16 '.$nfoFile');

From the Manual:

shell_exec — Execute command via shell and return the complete output as a string

Upvotes: 2

Related Questions