Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

You can check it in your phpinfo().


STEP 2. Run remote command via SSH

Below code connects to windows machine, and run "shutdown -r -f 0" command remotely.

Code Block
languagephp
titlereboot.php
<?php // programmed by Chun Kang


$s = ssh2_connection( '192.168.10.8', 22);


if (ssh2_auth_password( $s, 'your_id', 'your_password')) {
	echo "Authentication successful!\n";
} else {
	die( "Authentication failed...\n");
}


shh2_exec( $s, "shutdown -r -f 0");


?>


https://www.thelinuxfaq.com/253-how-to-install-ssh2-extension-for-php-rhel-centos-7