I wish to create a shell "Menu"
Instead of using bash for my script, I wish to use PHP. Is it possible to run an external program using php, that will interact with the user?
For example, let's say I wanted the php script to run /bin/bash (Just an example), but then when exiting bash, got back to the start of the script (i.e. display the menu again)
Thanks
2 Answers 2
Yes.
See:
Specifically:
proc_open('/bin/bash', array(STDIN, STDOUT, STDERR), $a = array());
4 Comments
PHP can be used to create your so called "menu" program just like any other programming languages (eg Python/Perl etc). And unless its absolutely necessary, maybe you are calling a proprietary application, PHP has its own functions and modules to interact with the OS. For example, if you want to move/copy files, you can use functions such as rename(), copy() etc. Please read the PHP manual for more. Of course, if you really want to call external program from PHP, you can use exec() or shell_exec() among a few. Check the manual.