Install phpseclib into the specified location :
# cd /path/to/install/phpseclib
# composer require phpseclib/phpseclib
or
# composer require phpseclib/phpseclib:~2.0
http://phpseclib.sourceforge.net/ssh/2.0/examples.html
<?php
require __DIR__ . '/../vendor/autoload.php';
use phpseclib\Net\SSH2;
use phpseclib\Crypt\RSA;
$ssh = new SSH2('web.goweekend.ca');
$key = new RSA();
$key->loadKey(file_get_contents('/home/apache/.ssh/id_rsa'));
if (!$ssh->login('dboard', $key)) {
exit('Login Failed');
}
$deploymentScript = 'sudo /autoDeployment/deployApplication.sh uat install ETFTrade server1 /path/to/earFiles/ETFTrade.ear 100 true';
$ssh->setTimeout(1800);
$ssh->exec(
$deploymentScript, function ($str) {
echo $str;
flush();
ob_flush();
});
?>