Jump to content

Execute program in terminal by PHP & work with input/output


fibokowalsky

Recommended Posts

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.