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?
1条回答 默认 最新
doupu1957 2011-12-20 03:20关注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
sshvia exec() is the next best thing (but requires some setup, you need keys rather than password authorization):print exec("ssh user@server 'ls -l'");本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报