在远程服务器上运行Exec()

Can I use PHP exec() to run a terminal command on a remote server? If not, what can I use and how? I need to execute a terminal command on a remote server. What are my options?

You can use ssh2_exec() instead. And very obviously you need permission (= an account) on the remote server and an enabled SSH service. It's quite a standard option for Unix/BSD/Linux servers.

If you don't have that extension installed, then using ssh via exec() is the next best thing (but requires some setup, you need keys rather than password authorization):

 print exec("ssh user@server 'ls -l'");