Jump to content

exec() wont take arguments


sweepy

Recommended Posts

Hi, im trying to run an external program on my web server using exec. It works fine if I do not pass any arguments, but fails if i pass one or more arguments as below:

 

$command = "mycommand.exe";

$output = array();

exec($command, $output, $ret);

 

if ($ret == 0){

foreach ($output as $line) {

echo "$line \n";

}

}

 

The above works fine and outputs the stdout from the program, but if I now change $command = "mycommand.exe arg1";

I get no output whatsoever, not even an error to the screen or output to any log.

 

I've also tried using backticks, system and passthru but still get the same problem, and I've tried $command = "cmd.exe /C mycommand.exe arg1"

 

Any ideas on what the problem is?

 

Cheers

Link to comment
https://forums.phpfreaks.com/topic/99956-exec-wont-take-arguments/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.