Brian
Brian

Reputation: 2147

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 could always install Apache on the second server and call the remote script via http, but would like to avoid that if possible.

Thanks, Brian

Upvotes: 0

Views: 302

Answers (1)

NullUserException
NullUserException

Reputation: 85458

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.

Upvotes: 1

Related Questions