FET Forum

FET Support (English) => Programming Help => Topic started by: Hema on March 24, 2011, 11:27:35 PM

Title: Putting fet file into FET program by the terminal
Post by: Hema on March 24, 2011, 11:27:35 PM
Hi every one,
I've .Fet file I need to put (running) it into FET program by the PHP, How I can do it? I using SUSE 11.2!!
Other question how I can running FET by the terminal?

I need your help, thanks  ::)
Title: Re: Putting fet file into FET program by the terminal
Post by: Liviu Lalescu on March 25, 2011, 02:45:51 PM
Quote
Other question how I can running FET by the terminal?

I can only answer this question, which is easy for me. Open konsole, cd to the fet executable directory and type ./fet
Title: Re: Putting fet file into FET program by the terminal
Post by: Hema on March 25, 2011, 02:52:26 PM
Thanks for your help, that is great :) but how I can put it into php code OR How I can run Fet by PHP code?
[size=9]xxxx@linux-jlb7:~/fet-5.14.2> ./fet --inputfile=Hopwood.fet[/size]
Title: Re: Putting fet file into FET program by the terminal
Post by: Liviu Lalescu on March 25, 2011, 03:02:53 PM
Maybe you could search the Internet for running executables by PHP or javascript. If you find the answer to your question, please let us know in this thread.

I would suggest you to upgrade your FET to the latest version, it is not difficult.
Title: Re: Putting fet file into FET program by the terminal
Post by: Hema on March 25, 2011, 06:10:07 PM
These days, I trying to read about exec and other PHP functions, Inshallah I'll tell you if everything is OK.
Thanks for your help and for FET's update :)
Title: Running fet on the background by PHP
Post by: Hema on March 31, 2011, 03:44:52 AM
Assalam,

Alhamdulillah  :)  the problem is solved with exec(), and fet is running in the php background correctly :), AND I have seen instructors' tables which were produced.....

Must to be do:
1- After compile  FET command line version.
2- putting your program fet, input file such as: Hopwood.fet and your php code under /srv/www/htdocs/

The PHP code:

<?php

'xhost +local:apache';  //Give permission for apache to use x server

if (exec("export DISPLAY=:0  && ./fet --inputfile=Hopwood.fet
--outputdir=hema 2> /tmp/error.log"
) )
&
#123;
//exec("export DISPLAY=:0  && ./fet --inputfile=Hopwood.fet
--outputdir=hema 2> /tmp/error.log");
   echo "
done" ;
&#125;
?>


4- after that open your browser and write localhost/php_file.php, then you can see your outputs :)

exec (): Execute an external program
'xhost +local:apache' and DISPLAY=:0 to give permission for apache to use x server.

PS: you can do this command in terminal for give xserver permission  xhost +local:apache.

Mahioo,helped me a lot ::)

Good luck!