Versions Compared

Key

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

I wanted to run a specific command through ssh protocol on my server. And this is super helpful to do some kind of remote processing by PHP easily, so I do not need to log on remote server.

STEP 1. Installing SSH2 Extension

The first thing you need to check is if your system has SSH2 features or not. You can simply check at phpinfo() in php function. If not, you can simply install SSH2 functions by below commands in root permission. The below case is based on  Centos7.

...

You can check it in your phpinfo().


STEP 2. Run remote command via SSH

Example 1) Rebooting remote windows machine

...