PHP Restart remote machine
1. Execute code shutdown-r-M \\192.168.1.113-t 0-f in local cmd environment
2. Ability to execute code in PHP environment EXEC ("mkdir c:\\test", $out);
Print_r ($out);
?>
3. I want to restart the remote machine so I wrote the following code EXEC ("Shutdown-r-M \\\\192.168.1.113", $out);
Print_r ($out);
?> But the operation is not successful, the remote machine can not be restarted, to help you the great God
------to solve the idea----------------------
Server A re-activate server B
Server A Domain http://servera.com/shutdown.php
Server B domain http://serverb.com/shutdown.php Apache needs to be administrator rights
In Server A's shutdown.php, using Curl to access Server B's shutdown.php can be a reality.
Server A
shutdown.php
$ch = Curl_init ();
curl_setopt ($ch, Curlopt_returntransfer, true);
curl_setopt ($ch, Curlopt_url, ' http://serverb.com/shutdown.php ');
$response = curl_exec ($ch);
if ($error =curl_error ($ch)) {
Die ($error);
}
Curl_close ($ch);
echo ' Shutdown Server B success ';
?>
Server B
shutdown.php
$cmd = "Shutdown-r";
EXEC ($cmd, $out);
Echo $out;
?>