2

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 ?

4
  • What does infekt-cmd.exe do? Does it prints something to the output? Commented Jan 29, 2018 at 10:45
  • Yes, print that file is saved as xxx.nfo Commented Jan 29, 2018 at 10:45
  • Try the code in my answer. Commented Jan 29, 2018 at 10:46
  • excel will print the output exactly the same as the output you would see if you have execute the command from the command line. So, are you sure the program you are trying to execute return something? Commented Jan 29, 2018 at 10:51

1 Answer 1

2

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

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.