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:
Use
exec()
to execute a program that connects to this other server and does whatever.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.
精彩评论