PHP/ command-line program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ktsirig
    New Member
    • Oct 2005
    • 11

    #1

    PHP/ command-line program

    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 command-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.

    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].

    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???

    Do you think it would help if I did anything with Perl? A kind of CGI-script??? I read tha PHP's functions are not wise to use in those cases...
    Thanx a lot!
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Heya, ktsirig.

    Have a look at this page.

    Comment

    Working...