Execute interactive bash menu script in browser with PHP

I have an interactive menu script written in bash and I would like use PHP to open the interactive bash menu in a browser.

Is this possible?

Using the sytem() function in php runs the script but it's all garbled.

Seems like maybe a terminal window needs to be opened in php first?

Thanks for any help.

if your writing a command line PHP script then yes. If your executing this from a web browser then no.