Launching an executable

A place for users and developers of the Xataface to discuss and receive support.

Launching an executable

Postby camt » Fri Jan 20, 2012 4:23 am

My company has a license generator executable, my idea was for parameters to be entered, then when the data is submit, it also fires off this program and passes it those parameters.

Can this be done?

I know that php has the exec() and other functions, and a CGI script can be run from apache. Have written php scripts to launch an executable on their own and tried a few things but cannot get them to run from an action in Xataface.

Any help on whether this could be done would be greatly appreciated.

Cheers,
Cam
camt
 
Posts: 17
Joined: Wed Jan 04, 2012 9:28 am

Re: Launching an executable

Postby amrcode1 » Mon Jan 23, 2012 7:42 am

Hi, I setup something like that, my case is this:
User need a report (some operations) so, we have a easy-table with fields like parameters.
User Save this record (request) of report.
In Delegate Class (Mytable.php) i use the aftersave function of Xataface, collect the fields (parameter) and use function exec() and pass all parameters.
Code is like this:

Code: Select all
<?
class Table{

   function afterSave(&$record){
      $qed = $record->val('id');
      $proj = $record->val('project');
      $date1 = $record->val('date1');
      $date2 = $record->val('date2');
      $sp=" ";
      exec("/usr/bin/R --vanilla --args ".$qed.$sp.$proj.$sp.$date1.$sp.$date2." < r/aed.R");
}
?>


This Call the Statistical program R, pass all the args, R run all the code in the aed.R, and insert all the results in the same record with $qued, in this case, i don't have control of execution (time) of R, this procedure take in the max case 10 minutes, i hope this can help you.
amrcode1
 
Posts: 18
Joined: Thu Nov 12, 2009 11:09 am

Re: Launching an executable

Postby shannah » Mon Jan 23, 2012 12:31 pm

As the above response exemplifies this certainly can be done. If you are having trouble running exec from a Xataface action, check the error log to see what the problem is. Some servers put restrictions on the use of functions like exec, so you might have to tinker with the settings to get everything working...

-Steve
shannah
 
Posts: 4457
Joined: Wed Dec 31, 1969 5:00 pm

Re: Launching an executable

Postby camt » Wed Jan 25, 2012 7:03 am

Thanks very much!
Am currently testing on a windows machine but will let you know how it goes.

Regards,

Cam
camt
 
Posts: 17
Joined: Wed Jan 04, 2012 9:28 am

Re: Launching an executable

Postby camt » Fri Feb 24, 2012 3:19 am

Thank you - this works great on our linux server, for Windows it was much more difficult to set up.
camt
 
Posts: 17
Joined: Wed Jan 04, 2012 9:28 am


Return to Xataface Users

Who is online

Users browsing this forum: No registered users and 26 guests

cron
Powered by Dataface
© 2005-2007 Steve Hannah All rights reserved