Jump to content

php/linux interaction via shell


implet

Recommended Posts

heya

i'm want to execute a program in the shell using php. this is what happens in the shell and what I want to do in php:

 

ben@ben-laptop:~$ cd /usr/local/sage-3.2.1 && ./sage

----------------------------------------------------------------------

| Sage Version 3.2.1, Release Date: 2008-12-01                      |

| Type notebook() for the GUI, and license() for information.        |

----------------------------------------------------------------------

sage: 1+2

3

 

i've tried this:

exec("cd /usr/local/sage-3.2.1 && ./sage",$s);

echo shell_exec("3+4");

print_r($s);

 

it outputs:

 

Array ( [0] => ---------------------------------------------------------------------- [1] => | Sage Version 3.2.1, Release Date: 2008-12-01 | [2] => | Type notebook() for the GUI, and license() for information. | [3] => ---------------------------------------------------------------------- [4] => ********************************************************************** [5] => Welcome to IPython. I will try to create a personal configuration directory [6] => where you can customize many aspects of IPython's functionality in: [7] => [8] => /root/.sage/ipython [9] => Initializing from configuration /usr/local/sage-3.2.1/local/lib/python2.5/site-packages/IPython/UserConfig [10] => Please press  to start IPython. [11] => ********************************************************************** )

 

how can i output what i did in the shell to the browser?

 

thanks

Link to comment
https://forums.phpfreaks.com/topic/140372-phplinux-interaction-via-shell/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.