开发者

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

开发者 https://www.devze.com 2023-02-13 02:23 出处:网络
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

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

精彩评论

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