Forum Moderators: phranque

Message Too Old, No Replies

Calling external executable with parameters from PHP

How to initiate external processing from a webpage?

         

lammert

6:03 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have some on-line calculations running on one of my websites. People can enter parameters on a page, and when they press the "calculate" button a form is posted and the webserver reloads the page and displays the output. I have written this in PHP and it all works fine.

I now want to enhance this system in such a way, that a very difficult calculation is performed. I cannot use PHP to do this calculation because it would take to long and the type of calculation is not supported by PHP, so I have to use an external executable. I don't want the visitor to know that an executable is called. How do I set this up in such a way, that I first show a page with a form where the user can enter his parameters (text and numeric), then do a POST, GET, or whatever to call the external executable and after the executable is finished a new page is loaded with the results?

My environment

  • Server: Linux
  • HTTP server: Apache 1.3
  • Executable: Created with gcc

jatar_k

6:15 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



options

use exec, passthru or system to execute
use curl or fsockopen to post to the exe and display results

lammert

8:40 pm on Aug 12, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Thanks for the quick reply. It seems that the exec() is what I need in my situation.