I am trying to connect SSH to EC2 server with privatekey using php (phpseclib). I’ve downloaded phpseclib from GitHub and added into libraries folder.
My code:
/* $dir --- contains my library folder path */
include($dir.'phpseclib3/Net/SSH2.php');
include($dir.'phpseclib3/Crypt/PublicKeyLoader.php');
$key = new PublicKeyLoader();
$key->loadPrivateKey(file_get_contents($ppkpath));
$ssh = new SSH2('ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com');
if (!$ssh->login('ec2-user', $key)) {
exit('Login Failed');
}
while executing this I got the following error
Class ‘PublicKeyLoader’ not found