Nice idea, a PHP console. I guess it will be like a telnet session in your browser.
For program execution functions, look at http://www.php.net/manual/en/ref.exec.php
. I don't know why your "> output" doesn't work. On UNIX systems, the >, < etc. are not parsed by the program, but by the shell, e.g. bash. Maybe you work with PHP on windows??? Maybe your command line is not parsed by a normal shell so that you can't use > ???
Anyway, I think that you need the proc_open and proc_close functions. You can access either input or output with a file descriptor, just like ordinary files.
How are you going to make this interactive? For example when the user hits a character on his keyboard, how are you going to give that key to the PHP script? Does the PHP script run in an infinite loop (which means that the page will never completely be loaded), or does it end (which may mean that the child process also ends)?