I presume you'll be using port 80 as your interface to the SSH session? If so, you'll need to setup a socket server to listen for the requests on port 80 (sort of like a mini-web server) and then translate them to the SSH session.
PHP by itself will not do this for you. When running exec() and system(), it just runs the command and waits for the output. If the command never returns, then the script times out or you hang PHP. So you'll need to build a PHP interface to interact with the SSH session.
You REALLY want to use care here. Fiddling with exec() and system() is like playing with fire. Fiddling with a gateway to SSH on another server is like playing with explosives. It can be done, but if you have no concept of security, you are building one really big hole for folks to walk through.