开发者

PHP - Specifying server for exec'd command to be run on

Using PHP, exec('php test.php'); will execute a separate PHP script on the command line.

What if test.php lives on another server, but within the same network? Can I specify that server's local IP address for the shell command to be run? What about a remote IP address? I coul开发者_Go百科d always install Apache on the second server and call the remote script via http, but would like to avoid that if possible.

Thanks, Brian


I can think of two options:

  1. Use exec() to execute a program that connects to this other server and does whatever.

  2. Set up a web service on the receiving server, and have the sending server send a request.

Regardless of what you choose to do, you'll need some setup on the receiving end, for the obvious reasons Dan Grossman pointed out.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜