views:

29

answers:

2

I have an application on my server that is called leaf.exe, that haves two arguments needed to run, they are: inputfile and outputfile, that will be like this example:

pnote.exe input.pnt output.txt

The executable is at exec/, inputfile is at upload/ and outputfile is on compiled/. But I need that a PHP could run the application like that, then I want to know:

  • How could I do this on a server that have exec() disabled and I can't turn it on, because I don't have privileges to do it?
  • How could I echo the output of the program?
+3  A: 

The exec function is probably what you're looking for: PHP: exec - Manual

Hober
+2  A: 

There are a fair amount of ways to do this. It partly depends on how your executables act and what they return. Have a look at System Program Execution. Hober suggests exec(), and that may be right. Another possibility may be passthru()

artlung
Yeah, `passthru()` may be the real answer. As the `exec()` documentation reads: "If you need to execute a command and have all the data from the command passed directly back without any interference, use the passthru() function."
Hober