fibokowalsky Posted October 28, 2011 Share Posted October 28, 2011 I want to enable running some program (namely, trale - grammar checking program) on the web page. On my Ubuntu OS I run the program in terminal and give inputs in terminal too. - So I want to run the program in terminal by and feed with inputs by PHP, also display outputs in HTML. shell_exec() function was not helpful since after executing the script for running the program $foo = shell_exec('trale -sag'); I can not use the same function for giving inputs to the program, the successor commands are executed in new terminal where trale in not running. && and ; separators for the bash commands does not work as after the first command (running the program) next commands are executed only after the running program is halted. Is there some shell object for PHP in which I can run several commands without losing the previous states?, e.g. ~$ trale -sac #running the program |: <some input for trale> # trale is already running I also found the simulation of terminal in PHP (PHP Terminal © bzrudi 2004) but it does not save previous states of the terminal. - thanks in advance. Quote Link to comment https://forums.phpfreaks.com/topic/250025-execute-program-in-terminal-by-php-work-with-inputoutput/ Share on other sites More sharing options...
trq Posted October 29, 2011 Share Posted October 29, 2011 You should look into the Expect extension: http://www.php.net/manual/en/expect.examples-usage.php Quote Link to comment https://forums.phpfreaks.com/topic/250025-execute-program-in-terminal-by-php-work-with-inputoutput/#findComment-1283170 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.