Execute external program via PHP

A

Anonymous

Guest
Hi all,
I need to execute a command-line program through PHP.
I have a form which includes a textarea, where the user writes his data.
These data will be used as input for the commend-line program.
Will I go something like:

$data = $_GET['info'];
Which function shall I use? System, exec, shell_exec, passthru?
I can't choose which one is the correct.
By the way, the command which I use when I write the script in the command line is :

program_name [argument1 -> A database file] [argument2 -> info supplied by user]

So, in the function that will be used, the data supplied by the user will be passed as my second argument (the 1st argument is a file in my hard disk).

And, lastly, do I need to change any global settings for PHP in order to perform such actions, ie running scripts via PHP programs???

Thanx a lot!
 
Hi, thanx for your answer

I asked about these functions, because the programm running in the command-line is an biological algorithm which is complicated, and, of course not written by me, so I could interfere with the code.
It is an .exe program, called hmmpfam, so in the command line, I write:

hmmpfam [file in hard disk] [data submitted]

and the algorithm searches the [file in hard disk] for patterns that match the [data submitted].

That's why I can't find another way to do it...
Do you think it would help if I did anything with Perl? A kind of CGI-script???
I tried the exec command, but it didn't seem to work..
Will the data be outputed to the screen immediately??

Would it be easy for you to supply a mini-example for me?? :help:
 
Back
Top