In this tutorial we will learn how to connect SSH using PHP. Follow below steps to get your answer about the question which is in your mind about PHP execute SSH command on remote server .
Here I will take a very easy and simple example to connect with SSH remove server and run command using PHP.
Lets get your answer by using below example code.
$host = '220.127.116.11';
$port = 22;
$username = 'root';
$password = '00cd6bf584e....';
$connection = ssh2_connect($host, $port);
ssh2_auth_password($connection, $username, $password);
$stream = ssh2_exec($connection, 'df -h');
$output = stream_get_contents($stream);