i have linux servers and i want to execute commands in my box 1 using my box 2 using php. i read that passthru can do this but whenever i use it the command executes in box 2 and just outputs the result in box 1.
for example i use
passthru('ls');
the list of the current directory in my box 2 is listed instead of my box1. can anyone tell me if i am doing anything wrong. thank you.
you could place the php script in a directory underneath your document root on box 1 and password protect this directory. then in a php script on box 2 you can use passthru (or maybe exec suits you better?) to execute curl.
an example with exec:
exec ("curl --connect-timeout 30 --user yourlogin:yourpassword http://box1.domain.com/protected/remotescript.php", $returnedCurlOutput);